Sunday, March 29, 2009

Firebird on Glassfish

Ok, so after a few hours of "pulling my hair out" (I don't actually have any...), I've finally managed to get Glassfish to work with Firebird.

Configuration:
Firebird 2.1.1(.17910-0_Win32 Classic)
Jaybird JDBC Driver 2.1.6 (JDK 1.6)
Sun GlassFish Enterprise Server 2.1

How-to:
0. Stop your domain
1. Copy jaybird-2.1.6.jar and jaybird-pool-2.1.6.jar into your domain's lib
Do NOT put the JARs into ext like I did. It ended up being the biggest source of pain in trying to get this to work.
2. Start your domain
3. Log into the admin console
4. Select Resources->JDBC->Connection Pools -> New
5. Enter a name and select javax.sql.ConnectionPoolDataSource resource type (leave vendor blank) and click Next
6. Enter 'org.firebirdsql.pool.sun.AppServerConnectionPoolDataSource' for Datasource Classname
7. Enter the following additional properties (note, I am using UTF-8, you may need to change your charSet and encoding (or just omit them))
charSet = UTF-8
encoding = UNICODE_FSS
userName = XXX
password = XXX
database = localhost:C:/Databases/DATABASE.FDB
databaseName = localhost:C:/Databases/DATABASE.FDB
(Yes, databaseName is deprecated in Jaybird, however the connection pool datasource won't work without it)
8. Enjoy

3 comments:

  1. When I see this:

    > localhost:C:/Databases/DATABASE.FDB

    I always wonder why people are allergic to aliases ;)
    The lack of a SQL interface is part of the problem, but still ...

    ReplyDelete
    Replies
    1. Because aliases does not work, I spent a lot of time trying to make it work.

      Delete
  2. Hi Craig,

    Thanks for posting this. I found it to be quite valuable for getting FireBrird running on GlassFish.

    I ran into an issue with the JayBird driver, but I was able to find the solution here: http://csujo.blog.hu/2008/10/21/firebird_vs_glassfish_vs_netbeans. You'll need to translate it, unless you are fluent in Hungarian, but it's one of the only other resources on the web for FireBird and GlassFish. Thought I'd provide the link here in case anyone else runs into a similar issue.

    ReplyDelete