-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tom,
Tom Henricksen wrote: | org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver | of class '' for connect URL 'null' Aah, yes. The old "connect URL 'null'" problem. This is always a problem with some nitpicky detail in your configuration, /or/ that you have your driver JAR in the wrong place (or too many places). First check to see where you have put db2driver.jar (or whatever DB2 calls its driver library). It should only exist in one place. Since you have your DataSource configuration in your context.xml, I think that you can simply put it into your application's lib directory and leave it at that. However, if you also have it in your TOMCAT_HOME/(common|shared)/lib, things won't work. Pick one location and stick with it. I have my MySQL driver in one place only: TOMCAT_HOME/common/lib and nowhere else. | I have an application in Tomcat 5.0.30 that we are trying to get to use | JDBC through JNDI. Since you are making such a change, would upgrading Tomcat be a possibility? Tomcat 5.0 is no longer supported. Upgrading to 5.5 should not be all that painful. | I have setup the context.xml | | | | <Context debug="4" | docBase="C:/Java/eclipse-europa/europa-workspace/bop-med/web" | path="/bop-med" reloadable="true" | workDir="work\Catalina\localhost\bop-med"> Bad boy: take out the docBase and path attributes. At best, they will be ignored. At worse, they will confuse both you /and/ Tomcat. Feel free to leave workDir in there, though it is not required. Unless you /need/ to specify it, you should take that out and let Tomcat do what it wants. | <Resource name="jdbc/medical" | type="javax.sql.DataSource" | password="password" | driverClassName="com.ibm.db2.jcc.DB2Driver" | maxIdle="2" | maxWait="5000" | validationQuery="select * from sysibm.SYSDUMMY1" | username="user" | url="jdbc:db2://server:50000/db" | maxActive="4"/> | </Context> In my configuration, i also have: auth="Container" Note that setting the validationQuery without also setting testOnBorrow="true" will result in the validationQuery being ignored. | And I have setup the web.xml with | | | | <resource-ref> | <description>DB Connection</description> | <res-ref-name>jdbc/medical</res-ref-name> | <res-type>javax.sql.DataSource</res-type> | <res-auth>Container</res-auth> | </resource-ref> Technically, you don't need this, but it's not a bad idea to leave it in there. | initCtx = new InitialContext(); | Context envCtx = (Context) initCtx.lookup("java:comp/env"); | DataSource ds = (DataSource) envCtx.lookup("jdbc/medical"); | | Connection conn = ds.getConnection(); | | System.out.println("DB Version : " | + conn.getMetaData().getDatabaseMajorVersion()); | | conn.close(); This code looks fine (though you don't really have to do two separate lookups -- you can combine them into a single lookup). When you get it working, you should be checking for null, catching NamingExceptions and stuff like that, too. But this should work. Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkftAZMACgkQ9CaO5/Lv0PAy+gCgn4uSwY+hSQiQcTLb7lYIg04F uNcAnAo2QhichFNbHa4P24h7IA1X0XK4 =tR4e -----END PGP SIGNATURE----- --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]