Issue Details (XML | Word | Printable)

Key: JDBC-93
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Mark Rotteveel
Reporter: Marcel Gascoyne
Votes: 1
Watchers: 2

If you were logged in you would be able to see more operations.
Jaybird JCA/JDBC Driver

Problems with connection pooling on Sun Appserver 9.0_01 (Glassfish)

Created: 08/Nov/06 07:07 AM   Updated: 02/Sep/12 09:48 AM
Component/s: Connection pool
Affects Version/s: Jaybird 2.1
Fix Version/s: Jaybird 3.0.0

OS: Windows Server 2003
Appserver: Sun Java System Application Server Platform Edition 9.0_01 (build b14)
JDK: Sun Java JDK 1.5.0_09
Firebird: 1.5.2
Issue Links:

 Description  « Hide
We've problems with the connection pool on our appserver. The class used for the connection pool is org.firebirdsql.pool.sun.AppServerConnectionPoolDataSource.

At unspecific time, all attempts to use a connection from the pool is resulting in the following exception:

Error in allocating a connection. Cause: Connection could not be allocated because: Could not obtain connection during blocking timeout (5000 ms)

The connection limit on the pool is set to 100 connections. But where are only about 5 connections in use. If this exception occurs you must restart the appserver.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Marcel Gascoyne added a comment - 08/Nov/06 07:17 AM
The used firebird version is 1.5.3, not 1.5.2

Marcel Gascoyne added a comment - 19/Nov/06 10:38 AM
This issue also occurs with Firebird 2.0 (Release) and Jaybird 2.2.0 Beta driver.

Alexander Glazkov added a comment - 03/Jan/07 02:08 AM
After spending a few hours, it seems I have found the cause.

Normally, the databaseName parameter value has format SERVER/PORT:DRIVE:/PATH/FILE.GDB
This is the old format.

The section 6 in the FAQ provides a different format.


Try it. It should work.
If it works in your case, then there are 2 questions:
1. Why the connection pool does not support the old-style URLs.
2. Why the error message is so fuzzy.

My platform:
Windows 2000
FireBird 2.0
JayBird 2.1.1
JDK 1.5.0_10

Alexander Glazkov added a comment - 03/Jan/07 02:24 AM
One correction to the config above
JDK 1.5.0_08

Jaroslav Beran added a comment - 25/Apr/07 05:03 PM

I am unable to find org.firebirdsql.pool.sun.AppServerConnectionPoolDataSource class,
But I got the same error when I used org.firebirdsql.pool.FBWrappingDataSource class.

After several experiments I choosed org.firebirdsql.pool.FBSimpleDataSource and it works fine.

My properties for this data source are:

userName - myuser
password - mypass
database - localhost/3050:c:/db/ELITNET.FDB

My platform is:

- Win XP
- Sun Java System Application Server Platform Edition 9.0_01 (build b14)
- jdk1.6.0_01
- FireBird 2.0
- JayBird 2.1.1

Tray Allen added a comment - 06/Jun/07 03:39 PM

I am also confronted with some Trouble in using the Jaybird driver together with glassfish

This is the setup....

I wrote a session bean doing this:

public class MySessionBean implements MySession{
public String helloSession() {
try {
InitialContext ctx = new InitialContext();

DataSource ds = (DataSource) ctx.lookup("jdbc/TESTDB");

Connection con = ds.getConnection();
return "Hello my name is dycept and I am funky";
catch (Exception e)
return "whoops";


For that Session bean i wrote a client doning this:

public static void main(String[] args) throws Exception{
/*properties f?r jndi*/

Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
String foo;
String jndiName = MySession.class.getName();
InitialContext ctx = new InitialContext();
MySession remote = (MySession)ctx.lookup(jndiName);

So when i go into the Adminconsole of Glassfish to configure a connection pool and use one of the following:

- org.firebirdsql.pool.sun.AppServerDataSource
- org.firebirdsql.pool.sun.AppServerConnectionPoolDataSource

then I get an Errormessage, that looks like this when I run the Client:

javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: null; nested exception is:
java.lang.AbstractMethodError: org.firebirdsql.jdbc.FBConnection.getClientInfo()Ljava/util/Properties;
at ejb.dycept._MySession_Wrapper.helloSession(
at BClient.BClient.main(

Only if i set the class to be :

- org.firebirdsql.pool.FBSimpleDataSource

I can execute the Client without errormessage.

Plz help me I am very confused.... :-(

Carl Smotricz added a comment - 21/Jul/07 08:58 AM
I had the same problem and was able to fix it thanks to the comments in this issue - thanks!

In my successful configuration, I am using org.firebirdsql.pool.sun.AppServerConnectionPoolDataSource .
This is found in jaybird-pool-2.0.1.jar, which I placed into \glassfish\domains\domain1\lib along with jaybird-2.0.1.jar .

I specified Resource Type javax.sql.ConnectionPoolDataSource. Apart from all the defaults, I only specified "password", "userName" and "databaseName" properties. The latter is //localhost:3050/myalias , i.e. "new format".

I found that using an alias (specified in %FIREBIRD_HOME%\aliases.conf) helped avoid complications with colons and slashes in database path names.

Mark Rotteveel added a comment - 17/Jul/11 10:20 AM - edited
Current working theory:
Some Connection and ConnectionPool related classes have incorrect or incomplete synchronisation, secondly the BlockingStack used by PooledConnectionQueue (which is used amongst others by AppServerConnectionPoolDataSource and AppServerXADataSource) has incorrect synchronisation and stack semantics in both the timed and untimed pop.
In some situations this could cause the BlockingStack to be emptied instead of the first available value to be returned, and in other situations it could cause a thread waiting to pop a value to return null and not continue waiting for a value to become available.

I have yet to reproduce this problem, before I can actually fix this.

Mark Rotteveel added a comment - 17/Jul/11 04:26 PM
I committed a fix for the incorrect synchronisation and broken stack semantics of BlockingStack. I also added testcases for the issues, and removed unncessary code from BlockingStack.

As far as I can see this should fix the described issue, unfortunately I have only been able to reproduce this with a synthetic testcase. I will do some more investigation into a realistic reproduction case, and see if other synchronisation issues reported by FindBugs for Connection and ConnectionPool related classes could contribute to this problem as well.

Potentially this fixes other issues as well: JDBC-144, JDBC-131

Mark Rotteveel added a comment - 27/Aug/11 12:01 PM
Removed Fix version; for Jaybird 2.2 use org.firebirdsql.ds.FBConnectionPoolDataSource instead.

This class is considered for removal in Jaybird version after 2.2

Mark Rotteveel added a comment - 02/Sep/12 09:48 AM
Removed deprecated org.firebirdsql.pool.sun classes