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

From: Miguel Almeida <migueldealmeida(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Should we still put the driver in CATALINA_HOME/lib and not in the application's war?
Date: 2017-08-14 17:33:19
Message-ID: CA+AeW314mUadQcLGXWSm410xXmsdJ4ZXG5opKU1=2YTi_Gv4pw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2017-08-14 17:42:04 Re: Should we still put the driver in CATALINA_HOME/lib and not in the application's war?
Previous Message Zemian Deng 2017-08-11 08:26:51 [pgjdbc/pgjdbc] cd7769: fix: correct javadoc on PGResultSetMetaData.getFor...