Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"

From: Guy Rouillier <guyr-ml1(at)burntmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"
Date: 2010-06-03 23:51:17
Message-ID: 4C083FF5.9090207@burntmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message philfrei 2010-06-04 05:48:20 Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"
Previous Message Craig Ringer 2010-06-03 06:23:15 Re: jdbc works in java app, fails in servlet: "no suitable jdbc found"