Hi all,

I've successfully built a number of Tomcat projects using MySQL, but now I have to also use PostgreSQL for a small demo app. I'm having some trouble
with the context and datasource.

Setup: Tomcat 5.5.26 (unzipped from the Apache site)  on Mac OSX 10.5.2,
developing using Eclipse 6.0.1/MyEclipse;
PostreSQL 8.3.1 with postgresql-8.3-603.jdbc4.jar

The following test snippet works fine when run statically outside of Tomcat:

public static void main (String[] args)
                throws ClassNotFoundException, SQLException
        {
                Class pgClass = Class.forName("org.postgresql.Driver");
String url = "jdbc:postgresql://localhost:5432/ trackerdb"; Connection connection = DriverManager.getConnection(url, "trackermgr", "");
....goes on to retrieve rows from a table in trackerdb....

My Tomcat app has the following context.xml in META-INF:

<Context path="" debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/trackerdb" auth="Container" type="javax.sql.DataSource"
             maxActive="100" maxIdle="30" maxWait="10000"
             username="trackermgr" password=""
             driverClassName="org.postgresql.Driver"
             url="postgresql://localhost:5432/trackerdb"/>
</Context>

There is an AppListener which successully uses this to construct a DataSource. However, when I get to attempting to obtain a Connection, I get the following Exception:

Exception: Cannot create JDBC driver of class 'org.postgresql.Driver' for connect URL 'postgresql://localhost:5432/trackerdb' com.herenow.database.DAOException: Cannot create JDBC driver of class 'org.postgresql.Driver' for connect URL 'postgresql://localhost:5432/ trackerdb' at com.herenow.database.DAOBaseData.getConnection(DAOBaseData.java:38)
  ....etc....

However, the jar file postgresql-8.3-603.jdbc4.jar is present in the app's lib: tracker/WEB-INF/lib. I've also tried moving the jar to tomcat's common/lib, but I get
the same Exception.

What am I missing here?
Thanks in advance,
Ken Bowen
~
~
~
~
~
~
~
~
~
"tomcat-user-postgresql-context" 43L, 1985C written


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to