Subject Re: [Firebird-Java] how do i get pooled connection
Author Roman Rokytskyy
> if I instaniate FBConnectionPoolDataSource, it gives PooledConnection;


> if i get through the driver manager, i have no access to firebird
> specifics (rolename etc).

Not correct - you specify all Firebird specifics in extended properties:

Properties props = new Properties();
props.setProperty("user", "SYSDBA");
props.setProperty("password", "masterkey");
props.setProperty("sqlRole", "USER");
props.setProperty("encoding", "UNICODE_FSS");

Connection connection = DriverManager.getConnection(url, props);

> what should I do to be sure that connection/statement pooling is
> switched on?

When you use FBConnectionPoolDataSource or FBWrappingDataSource, there is a
setters setPooling(boolean) and setMaxStatements(int). There is no
connection and statement pooling when you obtain connection via
DriverManager - that is JDBC specification and implementation specifics -
pooling is built on top of the driver.

> i want it to be as easy as in faq:
> 002 Connection connection = dataSource.getConnection();
> but what that 'dataSource' object is made from?

FBWrappingDataSource dataSource = new FBWrappingDataSource();

dataSource.setPooling(true); // this is default value
dataSource.setMaxStatements(10); // default value

Connection connection = dataSource.getConnection();

But usually you do not instantiate DataSource object yourself, this is done
by your container (in this case Tomcat) and later bound to JNDI. Your
application looks like this

InitialContext ctx = new InitialContext();
DataSource dataSource = (DataSource)ctx.lookup(myJndiName);
Connection connection = dataSource.getConnection();

Sample configuration for Tomcat can be found at , for
Jakarta DBCP at

> ps. Roman, 'that' problem is still uninvestigated. cured with
> explicitly setting /tmp directory as directory for temp files. i will
> write more details later in that thread

So, I suspect that it would be enough to set the temp directory in Firebird
config - temp directory is used for sorting operations (ORDER BY). This
explains everything.