Tuesday, December 15, 2009

Firebird Connection Pool in Glassfish 2.x.x

We will create in a few easy steps a Firebird Connection Pool on GlassFish 2.1.1.

First of all, we need to download the latest jdbc driver from:


Extract the downloaded archive and take the jaybird-full-x.x.x.jar from the compressed archive and put in {glassfish}/lib directory and restart glassfish:

asadmin stop-domain domain1
asadmin start-domain domain1

Now we need to navigate to the administrator application:
Open the 'Resources' -> 'JDBC' -> 'Connection Pools' and select 'New.
Fill in the Connection Pool 'Name'.
Select 'Resource Type' : 'javax.sql.ConnectionPoolDataSource'.
Select 'Next'.

At the next page complete the 'Datasource Classname' with :


Then go down at the additional Properties.
Find and edit the following properties :
Select 'Name' : 'userName' and 'Value' : {db_user}
Select 'Name' : 'password' and 'Value' : {db_user_pass}
Select 'Name' : 'databaseName' and 'Value' : {host_name}:{db_path}
for example:
Select 'Finish'.

Navigate to Connection Pools and select the pool you just created.
Click Ping to test that it is working. If it is not, it is probably because you have mistyped the connection credentials. Go to 'Additional Properties' tab of the connection pool detail page and correct any errors. Try ping again.

Open the 'Resources' -> 'JDBC' -> 'JDBC Resources' and select 'New.
Fill the JNDI Name like 'jdbc/myconnnection'.
Select from 'Pool Name' combo box the pool we just created.
And select 'OK'.

The Connection Pool is ready!

You can find me on fiverr for more personalized requests on any java app server configuration problem or java error that you encounter, with deliverance of less than a day (true!) and money back guarantee if not satisfied.


  1. I'm making a connection with jaybird 2.1.5 e glassfish 2.1.1, instaled jaybird domains/domain1/lib folder and click ping when it shows the following error:
    Class name is wrong or classpath is not for: org.firebirdsql.pool.sun.AppServerDataSurce

  2. My friend teste. You need to put the jaybird jdbc library in {GlassFish_Home}/lib directory, and restart. I believe this will solve your problem.

  3. Hi. Just like to thank you on this great explanation. You've helped me a lot. Thank you.

  4. Hi, i´m using Glassfish 3 and firebird 2.5 with jaybird 2.1.6JDK6. Ping is ok and log show:

    [#|2010-11-05T16:06:31.156-0600|WARNING|glassfish3.0.1|javax.enterprise.resource.resourceadapter.com.sun.gjc.spi|_ThreadID=26;_ThreadName=Thread-1;|RAR7114: Unable to get ClientInfo for connection
    java.sql.SQLException: not yet implemented
    at org.firebirdsql.jdbc.FBConnection.getClientInfo(FBConnection.java:268) .................

    the class of persistence no return data and no crash

    ide netbeans 6.9

  5. Anonymous friend,
    I have found a [minor - fixed - closed] bug [- improvement ] in jaybird's tracker that references your problem. You can follow it here:


    I would suggest to ignore it, if everything else works fine. The new version 2.2 of JayBird will not have this problem. Then you can upgrade and get rid of it.

    If your log is full of these warnings you could remove them from the logger with classname : javax.enterprise.resource.resourceadapter.com.sun.gjc.spi and level SEVERE.

  6. minha conexao so funcionou assim:

  7. Dear friend,
    I don't speak spanish, but I'll give you an example:
    I don't think there is any need for a port. It's just a file. There is no port listener.
    Take care.

  8. Dear komarios! U've made my day, helping me to create connection to my FB! Thank you a lot!
    Can you please explain the need of supplying jaybird-full instead of jaybird-pool lib?

  9. Dear Tigra,
    Thank you for your kind words.
    Truth be told, I did not realize there was a jaybird-pool.jar lib in the package. I would gladly update my post, if you provide me with feedback in case it works with that lib as well.
    And there is also a lengthy faq inside the package at docs\faq.html, that is really helpful.

  10. I guess 3050 is the default port for firebird, like 3306 is the default for MySQL.
    I tried both
    and both worked.

    In firebird FAQ the connection string used in the example is something like this:
    Connection conn = DriverManager.getConnection("jdbc:firebirdsql:localhost/3050:/firebird/test.gdb", "sysdba", "masterkey");
    or "...localhost/3050:C:\\firebird\\test.gdb..." in Windows

    I still wonder why it does not work to use in Glassfish the resource type 'javax.sql.DataSource'
    with the class 'org.firebirdsql.pool.FBWrappingDataSource'
    or with the class
    It is written in the FB API that both implements javax.sql.DataSource...

    Anyway, thank you for the example. It helped me a lot.

  11. I have a problem. I followed all instructions and the Ping succeded...
    But now, I need to have a java WebService, deployed in glassfish, which access the firebird database to retrieve some information. However, the connection does not work.

    By the way, this same WS works with MySQL, but do not works with Firebird. I need to know what is wrong...

    Here is the connection class used by the WS.
    public class MyDAO {

    protected DataSource ds;
    protected InitialContext ctx;
    protected Connection conn;

    protected Connection getConnection() {
    if (conn == null) {
    try {
    ctx = new InitialContext();
    ds = (DataSource) ctx.lookup("jdbc/test");
    conn = ds.getConnection();
    } catch (NamingException e) {
    } catch (SQLException e) {
    return conn;
    The program throws an AbstractMethodError when it tries to execute the third line
    ( ... conn = ds.getConnection ).

    I would like to know why...

    Of course, the webservice is successfully deployed. The same WS works with mysql but do not works with FireBird.

    I am using Glassfish 3.1, Firebird 2.5 and the jaybird full 2.1.6.

  12. My friend Rodrigo,

    I can not think of any reason why it should not work with FireBird. All I can do is urge you to carefully check the connection pool properties in case of spelling mistakes. Then make sure that you can ping the Firebird DB through GlassFish GUI. And if the problem persists, paste the full Exception stack trace here, and i will see it again.


    1. Man.... I made a small test application just to show you, then I tested it and then... it works...

      I wonder why it did not work before... I think there was some problem in the database file... or in the jaybird.jar, since I recreated the database and re-downloaded the jaybird.jar

      The connection code and the glassfish parameters were absolutaly the same as the ones I tried before.

      Well, anyway thanks!

  13. I am glad it worked. It could have been a corrupted jar. It has happened before.Or corrupted database file.

  14. Thank you my friend!

    He saved my skin! I was about to give up using the firebird!