tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Chandler <>
Subject Struggling with basic database connection
Date Sat, 23 Sep 2006 08:24:07 GMT
I am struggling to figure out why my Tomcat installation is failing to allow 
me to connect my java web application to a database.  I am looking for ideas 
as to how to find out what is wrong.  I have (what I think) is the same setup 
on another machine and it works fine.  The only difference between these is 
that the working one in tomcat 5.0 and this machine is tomcat 5.5 (although I 
am just about and try with a 5.0 setup).

I am trying with this simple piece of code - plucked from the tomcat docs.

		Context initCtx;
		try {
			initCtx = new InitialContext();
			Context envCtx = (Context) initCtx.lookup("java:comp/env");
			DataSource ds = (DataSource) envCtx.lookup("jdbc/akcmoney");
			Connection conn = ds.getConnection();		
		} catch (Exception e1) {

and with debug, I can see that initCtX, envCtx and ds all are assigned non 
null values, but the ds.getConnection() results in the following.

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'

I have the postgresql jdbc driver jar in $CATALINA.BASE/common/lib

Server.xml contains

     <Context docBase="akcmoney" path="/akcmoney" reloadable="true"
          <Resource auth="Container" name="jdbc/akcmoney"
            <ResourceParams name="jdbc/akcmoney">

my WEB-INF/web.xml contains this reference.

 		<description>AKCMoney Database</description>

Anyone any ideas where I am going wrong, or how to look at the contents of the 
nitCtX, envCtx and ds variables in the above code snippet to understand how 
far I have got

Alan Chandler

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message