Subject RES: [Firebird-Java] Re: Connection Pool
Author Francisco Souza
Following the example which comes with Jaybird I always receive this
Excpetion (could you tell me why?):

java.sql.SQLException: Could not obtain connection during blocking timeout
(10000 ms)
at
org.firebirdsql.pool.PooledConnectionQueue.take(PooledConnectionQueue.java:2
96)
at
org.firebirdsql.pool.AbstractConnectionPool.getPooledConnection(AbstractConn
ectionPool.java:208)
at
org.firebirdsql.pool.FBConnectionPoolDataSource.getPooledConnection(FBConnec
tionPoolDataSource.java:232)
at
org.firebirdsql.pool.FBConnectionPoolDataSource.getPooledConnection(FBConnec
tionPoolDataSource.java:269)
at
org.firebirdsql.pool.FBWrappingDataSource.getConnection(FBWrappingDataSource
.java:140)
at DataSourceExample.main(DataSourceExample.java:63)
sql exception: Could not obtain connection during blocking timeout (10000
ms)

The file DataSourceExample.jva:
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:/Firebird_1_5/examples/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 ());
}
}
}

> Could anybody send me an example, can be a very simple one, about
> creating a Connection Pool with Jaybird?

See http://jaybirdwiki.firebirdsql.org/config/Configuration

> Still, what .jar file should I put in my package of my application?

firebirdsql.jar + firebirdsql-pool.jar + mini-j2ee.jar + mini-
concurrency.jar or simply firebirdsql-full.jar

Roman


Yahoo! Groups Sponsor
ADVERTISEMENT






Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/Firebird-Java/

To unsubscribe from this group, send an email to:
Firebird-Java-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.692 / Virus Database: 453 - Release Date: 28/05/2004