WebDevelopment, ColdFusion, Railo, JS, Database and Tech-related by the Co-Founder and CEO of tunesBag.com

Thursday 11 June 2009

Using the H2 database in ColdFusion

Railo is delivered with an embedded database called H2. The description on the homepage says:

Welcome to H2, the Java SQL database. The main feature of H2 are:

* Very fast, open source, JDBC API
* Embedded and server modes; in-memory databases
* Browser based Console application
* Small footprint: around 1 MB jar file size

Such a database fit's perfectly for a current task at tunesBag - the streaming servers should store some data on their own machines and mysql or postgresql just would be overkill for this task. So I decided to give H2 a look and it looks pretty nice.

On my local machine I'm working with ColdFusion 8 as well - the configuration to add H2 support for CF is very easy, just follow the following steps:

  • Download the latest version of H2
  • Drop the h2*.jar file in the WEB-INF/lib directory of your ColdFusion server (directory depends on your type of setup)
  • Restart CF
  • Add a new datasource
  • JDBC URL = jdbc:h2:file:%Path to Database file on your disk%
  • Driver Class = org.h2.Driver
  • Driver name = default
  • User name = sa

That's it - the files holding the data will be created automatically for you. Take a look at the H2 tutorial in order to find out more (e.g. server mode etc).

11 comments:

Tom Chiverton said...

Why is H2 better than the Derby database built into Adobe's CF server ?

Hansjoerg said...

I started playing around while using the latest version of Railo (railo is bundled with H2) and it worked pretty well so I decided to use it on ColdFusion as well, so no special preference is involved.

Unknown said...

Such a well written post.. Thnkx for sharing this post!
Thank You
ColdFusion Developer

Unknown said...

This is good stuff.

However I couldn't achieve the results using cold-fusion and h2 database.
1. I used the driver with this string "jdbc:h2:file:C:\mydb;MODE=MSSQLServer", I was able to connect and dump anything from information_schema but could not connect to user defined tables. The error message was Table not found.
2. Simply I was unable to connect using the following string
"jdbc:h2:tcp://localhost/C:\mydb"
Error Msg: "90067-146"

Raj Sankar

Wim said...

I'm having trouble using H2 BLOBS in ColdFusion. Whenever I do a select which should return a BLOB, I get a "file not found" error.

Adda52 said...

poker hands
I like to work with H2 database. It is very relevant for me.It is also very easy to install.

Brock Kutchera said...

atlanta hotels buckhead

Really beautiful! The articles are very informative. I am hoping the same best work from you in the future as well.

situsjudionline said...

DOMPETPOKER AGENCY JOIN POKER ONLINE UNLESS MONEY IS RELIABLE
DOMPETPOKER.NET IS A CARD REGISTERED SHARE OF RULES AND USUALLY (BUT NOT ALWAYS) IN HAND RANK. ONLINE POKER GAME IS DIFFERENT IN THIS HOW HOW THE CARD IS SHARED. IN THE MOST POKER GAME PLAYS, THE FIRST PLAY ROOMS STARTED WITH SOME OF SHAPE. TYPE OF CARDS IN POKER ONLINE.
ORIGINAL MONEY POKER | BEST ONLINE SERVER POKER AGENT
PLAY POKER OF ORIGINAL MONEY WITH THE BEST SERVER QUALITY AND THE LATEST DISPLAY ONLY ON THE POKER AGENT DOMPETPOKER WHICH PROVIDES SECURITY GUARANTEE IN PLAYING ONLINE POKER WITHOUT BOT, ADMIN AS WE ALWAYS PROVIDE THE BEST SERVICE FOR 24 HOURS EVERYWHERE, HERE ALL MEMBER CAN PLAY POKER EVERYWHERE AND WHY BECAUSE WE PROVIDE ANDROID APPLICATION AND IPHONE SO YOU CAN PLAY POKER IN YOUR SMARTPHONE.
LATEST PROGRAM SYSTEMS POKER SITE
THROUGH THE LATEST PROGRAM SYSTEM WE GIVE ANY WARRANTY GIFT WARRANTY GUARANTEE, GUARANTEED GUARANTEE QUESTIONS & MEMBER DATA SECURITY GUARANTEE, DOMPETPOKER IS ALSO EASY WHERE TO BECOME THROUGH THE SMARTPHONE APPLICATIONS AVAILABLE. REGISTER NOW & GET INTERESTING PROMO.
agen poker
poker online
agen poker terbaik
agen poker terpercaya
poker uang asli

Bounty Tournament said...

Thank you for sharing this nice information about this topic on your blog, it is very informatics info thank for this blog.

poker arrangement
poker india
poker hand sequence
indian poker online
instant sign up bonus poker
poker online india
poker myths
poker sequences
texas holdem poker
play poker game free
poker strategy
texas poker
play poker online

Lily said...





Wow! This could be one particular of the most beneficial blogs We have ever arrive across on this subject. Actually Excellent. I am also a specialist in this topic so I can understand your hard work.



Best Free Android Games of 2019


Danny Danials said...

I am questioning that during this time you must deliver a try and this new app Weather XL PRO Apk : which is now maximum trending app inside the global.