tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Marx" <>
Subject Problems with JDBC-Datasource as Resource in JNDI
Date Tue, 02 Apr 2002 09:37:28 GMT

I defined a mysql-Datasource as a resource in JNDI.
I can lookup the datasource but everytime when I call the Datasour -
getConnection Method 
the error message "no suitable driver" shows up.

Here are my configuration files:

WEB.XML: (only resource part)




   <res-auth />



   <Context path="" docBase="C:\struts_forte" debug="0">
className="org.netbeans.modules.web.monitor.catalina.MonitorValve" />
          <Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost__log."        suffix=".txt" timestamp="true" />
	  <Resource name="jdbc/MySQLDB" auth="Container"
	  <ResourceParams name="jdbc/MySQLDB">

















The JAVA - Code which tries to create the connection from the

      InitialContext ic = new InitialContext();
      DataSource ds =


      System.out.println("TEST:" + ic.INITIAL_CONTEXT_FACTORY);
	// When I comment the following line of code out I don't get the
exception but also
	// no connection :-(	
      Connection con = ds.getConnection();
      } catch(javax.naming.NamingException ex) {
      catch(java.sql.SQLException ex) {

The mysql-jar is in the lib directory of the web - application and also
lib - directory of my TOMCAT installation which is version 4.01.

Any suggestions how to solve the problem ? Is the URL to the my-sql
database ok or do I need to copy the mysql-drivers somewhere ?

Thanks in advance,

Frank Marx

To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message