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