Subject Connect to Firebird 1.5 using FBWrappingDataSource
Author marcioabt
Has anyone already made a connection to Firebird using a DataSource,
I mean, the FBWrappingDataSource class.

The following example came with JayBird but didn´t work.

Example:

public final class DataSourceExample
{
static public void main (String args[]) throws Exception
{
// Create an Firebird data source manually;

org.firebirdsql.pool.FBWrappingDataSource dataSource =
new org.firebirdsql.pool.FBWrappingDataSource();

// Set the standard properties
dataSource.setDatabase ("localhost/3050:c:/database/employee.gdb");
dataSource.setDescription ("An example database of employees");

/*
* Following properties were not deleted in order to show differences
* between InterClient 2.01 data source implementation and Firebird
one.
*/

//dataSource.setDataSourceName ("Employee");
//dataSource.setPortNumber (3060);
//dataSource.setNetworkProtocol ("jdbc:interbase:");
//dataSource.setRoleName (null);

// Set the non-standard properties
//dataSource.setCharSet
(interbase.interclient.CharacterEncodings.NONE);
//dataSource.setSuggestedCachePages (0);
//dataSource.setSweepOnConnect (false);

// this some kind of equivalent to dataSource.setNetworkProtocol
(String)
// possible values are "type4", "type2" and "embedded".
dataSource.setType("type4");

dataSource.setSqlRole("USER");
dataSource.setEncoding("NONE");

// other non-standard properties do not have setters
// you can pass any DPB parameter
dataSource.setNonStandardProperty("isc_dpb_sweep", null);
dataSource.setNonStandardProperty("isc_dpb_num_buffers", "75");

// Connect to the Firebird DataSource
try {
dataSource.setLoginTimeout (10);
java.sql.Connection c = dataSource.getConnection
("sysdba", "masterkey");
// At this point, there is no implicit driver instance
// registered with the driver manager!
System.out.println ("got connection");
c.close ();
}
catch (java.sql.SQLException e) {
e.printStackTrace();
System.out.println ("sql exception: " + e.getMessage ());
}
}
}


The error is:


java.sql.SQLException: Could not obtain connection during blocking
timeout (10000 ms)

at org.firebirdsql.pool.PooledConnectionQueue.take
(PooledConnectionQueue.java:296)

at org.firebirdsql.pool.AbstractConnectionPool.getPooledConnection
(AbstractConnectionPool.java:208)

at org.firebirdsql.pool.FBConnectionPoolDataSource.getPooledConnection
(FBConnectionPoolDataSource.java:218)

at org.firebirdsql.pool.FBConnectionPoolDataSource.getPooledConnection
(FBConnectionPoolDataSource.java:255)

at org.firebirdsql.pool.FBWrappingDataSource.getConnection
(FBWrappingDataSource.java:140)

at Conectar.main(Conectar.java:45)

sql exception: Could not obtain connection during blocking timeout
(10000 ms)

What am I doing wrong ? TIA

Márcio Barroso