Re: Right version of jdbc

From: Craig McIlwee <craigm(at)vt(dot)edu>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Right version of jdbc
Date: 2023-09-29 19:43:49
Message-ID: CAGqBcTYn7vpx2T+-AM_kS7fszGZfZMULLZw6DqXe=Dq6TnCkNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> for some reason the postgresql jar is not in the classpath.

This is due to the way that Tomcat loads drivers, which is documented at
[1]. In short, the JDBC driver should be placed in the tomcat/lib
directory and removed from the application's WEB-INF/lib directory. After
doing that, I was able to get past the "No suitable driver" exception.

OP, you should read that entire page, and in particular the portion at
[2]. By registering a "Resource" with Tomcat, you can let it manage a
connection pool for you (if you aren't already using something like
PgBouncer or pgpool) and, if registered at the container level, in the
future you can share that pool across all of your web applications in the
container.

[1]
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#DriverManager,_the_service_provider_mechanism_and_memory_leaks
[2]
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL

Craig

>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message pf 2023-09-29 20:37:39 cache lookup failed for function 0
Previous Message postgresql439848 2023-09-29 19:43:31 Re: Right version of jdbc