PostgreSQL - Installing JDBC driver

前端 未结 4 1420
误落风尘
误落风尘 2021-01-02 06:19

I\'m having a hard time working out how I should be installing the JDBC driver for PostgreSQL on my debian 6.0 server. I have moved the driver .jar into the following direct

4条回答
  •  甜味超标
    2021-01-02 06:38

    It is best to install your PostgreSQL driver into tomcat\lib folder. Just copy the driver jar to PATH_TO_TOMCAT\lib

    It is not a good idea to add things to the system CLASSPATH because you can end in class loader hell. Here is an example of how you end up in jar / classpath hell.

    • Suppose the current app uses postgres 9.1 and you setup the driver on the system CLASSPATH
    • You decide to run another app on that box which talks to a newer version of postgres lets say version 9.2
    • Because you are using the system classpath app 2 will end up using the old driver because the SYSTEM classpath tends to take precedence over an applications classpath unless the app launcher script sets CLASSPATH="" to empty out the system classpath or uses a custom class loader that does not do parent-first class loading.

    See http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html

提交回复
热议问题