Re: jdbc works in java app, fails in servlet: "no suitable jdbc found" - Mailing list pgsql-jdbc

From Guy Rouillier
Subject Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"
Date
Msg-id 4C083FF5.9090207@burntmail.com
Whole thread Raw
In response to Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-jdbc
On 6/3/2010 1:52 AM, Craig Ringer wrote:
> On 3/06/2010 12:15 PM, Manohar Bhattarai wrote:
>
>> I had the same problem of getting exception of class not found as you
>> are getting. I have solved the problem by simply putting the jar file in
>> CATALINA_HOME/lib/ directory. Then i restarted Eclipse.
>> And wow the driver was found. This was solved just yesterday. See if
>> this helps you.
>
> That's usually not the best way to do it (at least in Glassfish-land)
> though, because that jar is visible to all installed apps. It gets
> complicated if different servelets require different versions of some
> libraries.

I don't know the OP's configuration, but in Tomcat a common way to
handle database connections is to use the Tomcat-provide pooling
mechanism.  If this option is chosen, then you must get the appropriate
database drivers into Tomcat's bootstrap classpath.  Tomcat initializes
the connection pools before starting up any of the webapps, so putting
the database JARs into a particular webapp won't work.

If you elect not to use Tomcat's database pools, then of course you can
include the database drivers in with your application.  But then if you
have 3 or 4 applications using the same database, each will have its own
connection pool, which is sub-optimal.

--
Guy Rouillier

pgsql-jdbc by date:

Previous
From: Craig Ringer
Date:
Subject: Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"
Next
From: philfrei@aol.com
Date:
Subject: Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"