Subject Re: problem with Connection-Pooling
Author Roman Rokytskyy
> Now my custumer gets deadlocks from time to time (every few days),
> i have no conclusion, never have seen this with my application
> before.

> I thought blocking should only be necessary, if all connections are
> used.

That's exactly the case.

> But in my getConnection()-method i print out
> dataSource.getConnectionCount() and it says 0.
> This means that 0 connections are used when the error occurs or not.

That's probably bad name for the method and absence documentation.
This method return amount of free connections in the pool. 0 means
that blocking can occur. In order to be sure, you have also to look on
workingSize property (it must be equal to maxSize). However it is not
available in FBWrappingDataSource, only in FBConnectionPoolDataSource.
I will fix this.

> (Another Question is MinConnections only used when getConnection()
> is invoked for the first time ?

Correct. See
http://jaybirdwiki.firebirdsql.org/config/FBWrappingDataSourceParameters

Another property suggested by JDBC specs is called initialPoolSize,
but it is currently not supported.

> Or why can getConnectionCount() return values lesser than 5 ?)

FBWrappingDataSource.getConnectionCount() ==
FBConnectionPoolDataSource.getFreeSize(). See javadocs for
FBConnectionPoolDataSource.getFreeSize() method.

As a workaround you can replace FBWrappingDataSource with the
following code:

FBConnectionPoolDataSource pool = new FBConnectionPoolDataSource();
.... // set properties, they are the same
DataSource ds = new SimpleDataSource(pool);

FBWrappingDataSource is just a wrapper aroung
FBConnectionPoolDataSource and not all properties of it are visible
through FBWrappingDataSource.

Roman