Tuesday, July 29, 2008

Setting up ColdFusion and Firebird

After a long struggle on Devshed forums I decided to try on my own, after all I know Firebird and don't see why it and ColdFusion can't play nice together ... infact they did, and easily.
Already having installed on my PC the database (Firebird 2.5 Alpha1) and a client tool (Flamerobin 0.8.6) I went for the server, downloading and installing the free developer version of ColdFusion 8 from Adobe's site.
Install went smooth and I just confirmed every default option but the drive D: in my case instead of the standard C:
After the install finished I logged into the admin console at the default address and opened the Server Setting Summary:

The important things are highlighted:
  1. ColdFusion server version: 8,0,1,195765
  2. Edition: Developer
  3. Java VM Version: 1.6.0_04
With this infos at hand I went to Firebird site to download the appropriate driver version:

I chose the lates driver available, JayBird 2.1.6, for my JVM which is 1.6:


The driver downloads as a zip file, unzip it, extract the driver:

And place it along the other JDBC drivers in the ColdFusion server (the server config can tell you where they are), in my case D:\ColdFusion8\lib and restarted the server:


A quick check confirmed that the driver is in the server classpath:

Now I set up an alias for my Firebird database, just to have a simpler connectionstring, open up the file aliases.conf and add a row for your db, from now on you'll be able to refer to the alias instead of the full path to the db:


Don't forget to restart the Firebird server.

Ok, time to go back to ColdFusion and set up a Data Source:


Name it "LocalFirebird" and chose driver "other" from the drop down list, the click "Add".
After clicking "Add" a new form opens, asking for some other details:

Values are:

  1. JDBC URL: jdbc:firebirdsql:127.0.0.1/3050:pippo (note the alias, no need for the full path)
  2. Driver Class: org.firebirdsql.jdbc.FBDriver
  3. Driver Name: JayBird
  4. Username: your user, standard admin name is SYSDBA
  5. Password: your password, standard password for SYSDBA is masterkey
Now click "Submit" and you'll go back to the Data Sources list, click "Verify all connection" and wait to see if an "OK" appears for the new connection:

After confirming the datasource is OK you can go on and put up a quick test page.

A Devshed forum use has put up a quick tutorial some time ago, kudos to him but it looks like it's a bit old (2003) and "poor in graphics" ;), you can find it here, I added some notes there which correspond to the content of this post.

4 comments:

Angie said...

Thanks heaps! This blog will be very useful to many CF developers now. This would be the first real instruction on how to set them up together.
Btw, I did not use CF 8, I used CF 7 because some of the code does not work with CF 8.
I'm going to try this again. Thanks again pabloj.

Angie said...

Ok, I have tried this several times with CF 7 already but I still get the same error:

Connection verification failed for data source: testdb
java.sql.SQLException: Timed out trying to establish connection
The root cause was that: java.sql.SQLException: Timed out trying to establish connection

So I'm guessing its the version of CF. The jaybird drivers register in the Setting Summary, but its still not picking up. Will just work with FireBirdSQL jar file for now.

Unknown said...

Note: this did not work until I entered in 'org.firebirdsql.jdbc.FBDriver' in the driver class input. After that, it worked.

Great article, thanks!

Mimmo said...

If you change aliases.conf it's not needed to restart Firebird server.
Fb server accesses aliases.conf everytime you require an unknown database.