Check your validation query in your resource definition. -----Original Message----- From: Paul Mahoney [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 12:57 PM To: 'Parsons Technical Services'; 'Tomcat Users List' Subject: RE: Problem using JNDI/DBCP to get DataSouce
Tried dataSource = (DataSource) initContext.lookup("java:comp/jdbc/OscarsDB"); But it return null, so tried dataSource = (DataSource) initContext.lookup("java:comp/env/jdbc/OscarsDB"); And a datasource instance was return so before, looking good... However, still got the same exception when trying to get a connection instance "Cannot get a connection, pool exhausted" with a nested exception "Could not create a validated object" >-----Original Message----- >From: Parsons Technical Services >[mailto:[EMAIL PROTECTED] >Sent: 17 March 2004 16:49 >To: Tomcat Users List; [EMAIL PROTECTED] >Subject: Re: Problem using JNDI/DBCP to get DataSouce > > >Paul, > >Replace this: > if (dataSource == null) > { > Context initContext = new InitialContext (); > Context envContext = (Context) initContext.lookup >("java:comp/env"); > dataSource = (DataSource) envContext.lookup >("jdbc/OscarsDB"); > } > >With this: > if (dataSource == null) > { > Context initContext = new InitialContext (); > dataSource = (DataSource) initContext.lookup >("java:comp/jdbc/OscarsDB"); > } > >This is working fine for me. Just a note that I am running against MySQL, >but at this point in the code it should not matter especially since the >hardwire way works. > >Doug --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]