Hi,
I've got a servlet on Tomcat on Solaris and I'm using the H2 database (
It currently works without using DBCP, but to improve performance, I need to use connection pooling. I tried following the instructions I found here: But it's throwing a NoInitialContextException during the call to lookup().
Here's my getConnection() function:
Does anyone know what's wrong? I've never used DBCP and barely know anything about Tomcat configuration.
I've got a servlet on Tomcat on Solaris and I'm using the H2 database (
It currently works without using DBCP, but to improve performance, I need to use connection pooling. I tried following the instructions I found here: But it's throwing a NoInitialContextException during the call to lookup().
Here's my getConnection() function:
Code:
private Connection getConnection() throws QueueException
{
try
{
Context initContext = new InitialContext();
DataSource ds = (DataSource)initContext.lookup( "java:comp/env/QueueDB" );
return ds.getConnection();
}
catch ( NamingException e )
{
throw new QueueException( e );
}
catch ( SQLException e )
{
throw new QueueException( e );
}
}
Does anyone know what's wrong? I've never used DBCP and barely know anything about Tomcat configuration.