Re: Should we still put the driver in CATALINA_HOME/lib and not in the application's war?

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Miguel Almeida <migueldealmeida(at)gmail(dot)com>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Should we still put the driver in CATALINA_HOME/lib and not in the application's war?
Date: 2017-08-14 17:42:04
Message-ID: CADK3HHLh+rp-axs8bzKB5WF6Z29WiUz9ovk9NNa45Cm+ji2=Hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

So if you put them in tomcat's lib dir then yes it will be registered in
the JVM wide singleton. I would think this should not be a problem if you
put them the apps war file. All drivers register in DriverManager which
should be unique per app.

Dave Cramer

davec(at)postgresintl(dot)com
www.postgresintl.com

On 14 August 2017 at 13:33, Miguel Almeida <migueldealmeida(at)gmail(dot)com>
wrote:

> Dear all,
>
> I recently revisited the decision in my projects to put both the
> postgresql and c3p0 driver in Tomcat's lib directory instead of putting it
> in each application's package (see the stackoverflow post below [1], still
> unresolved!).
>
> In 2011 Philip Reichart mentioned that *JDBC drivers register themselves
> in the JVM-wide singleton DriverManager
> <http://download.oracle.com/javase/6/docs/api/java/sql/DriverManager.html>
> which is shared by all web apps. If you have the same (as in class name)
> JDBC driver register twice from two different web apps, this might cause
> your problem. This is even more problematic if your web apps use different
> versions of the same JDBC driver.*
>
> Is this still the case in 2017?
>
> The reason why this may become problematic is that my team is having
> difficulties upgrading the postgresql driver from version x to y, which may
> lead to the need to have different postgresql driver versions for different
> applications within the same tomcat container.
> Can you kindly help me underestand the consequences of that?
>
>
> [1] https://stackoverflow.com/questions/45621073/where-to-
> put-c3p0-dependency-in-tomcat-container
>
> [2] https://stackoverflow.com/a/7198049/475829
>
> Thank you very much for your input!
>
> Miguel Almeida
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Peter Eisentraut 2017-08-14 22:58:18 Re: Statement-level rollback
Previous Message Miguel Almeida 2017-08-14 17:33:19 Should we still put the driver in CATALINA_HOME/lib and not in the application's war?