Subject Re: [Firebird-Java] Re: Java: Cannot get a connection, pool exhausted
Author Roman Rokytskyy
> I am using my web.xml file to configure the driver and using the
> settings mentioned:
>
> I am using this driver:
>
> org.firebirdsql.jdbc.FBDriver

Where did you put the jar file? BTW, what version do you use?

> And this Database URL:
>
> jdbc:firebirdsql:localhost/3050:C:\\Subfolder\\Subfolder\\THEDB.FDB
>
> I believe this to be correct and I also believe that the server is
> running.

Ok.

> The following code is used to make the connection:
>
> DatabaseConfig databaseConfig = new DatabaseConfig();
> databaseConfig.setDriver( getInitParameter( "Driver" ) );
> databaseConfig.setDatabaseURL( getInitParameter( "DatabaseURL" ) );
> databaseConfig.setUsername( getInitParameter( "Username" ) );
> databaseConfig.setPassword( getInitParameter( "Password" ) );
> databaseConfig.setInitialconnections( convertToInt(
> getInitParameter( "Initialconnections" ) ) );
> databaseConfig.setMaxconnections( convertToInt(
> getInitParameter( "Maxconnections" ) ) );
>
> dataSource = getDataSource( databaseConfig );
>
>
> And the last line is producing a dataSource object (well it is not null).

Can you try to hardcode the values first? Or check in debugger that
getInitParameter(...) calls return correct values?

> But when I call the getConnection() I get the following errors:
>
> org.apache.commons.dbcp.SQLNestedException: Cannot get a connection,
> pool exhausted, cause:
> java.util.NoSuchElementException: Could not create a validated object
> at

Is that the only stack trace you have in the error log/console?

The issue is that it only tells that DBCP had some problem to create a
connection, but it is not clear why:

- did it find the driver in the classpath?
- did it have all properties correctly configured?
- did the driver return an error when connecting?

Roman