Subject: databases and JNDI resource problem
From: guido schnider <[EMAIL PROTECTED]>
 ===
While trying to connect a mysql DB with Tomcat 4.0.4-b1 ant struts 1.x 
as described in the Tomcat manual under JNDI Resources HOW-TO
I get the following error. It looks like that he is still looking for 
the HypersonicDriver as in the example, but i changed it.
Any ideas or working examples?
Thanks!

TyrexDataSourceFactory:  Cannot create DataSource, Exception
java.lang.ClassNotFoundException: org.hsql.jdbcDriver

PS: What is the smartest way working with Db's and tomcat/struts?

My configuration
-----------------------------------------------------------------------------
<!-- server.xml  -->
<Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/test">
        <parameter>             
                <name>user</name>               
                <value>root</value>             
        </parameter>            
        <parameter>             
                <name>password</name>           
                <value>root</value>             
        </parameter>            
        <parameter>             
                <name>driverClassName</name>
                <value>org.gjt.mm.mysql.Driver</value>          
        </parameter>            
        <parameter>             
                <name>driverName</name>         
                <value>jdbc:mysql:database</value>              
        </parameter>            
</ResourceParams>
-------------------------------------------------------------------------
<!-- Web.xml  -->
<resource-ref>
   <description>
     Resource reference to a factory for java.sql.Connection
     instances that may be used for talking to a particular
     database that is configured in the server.xml file.
   </description>
   <res-ref-name>jdbc/test</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
</resource-ref>
-------------------------------------------------------------------------
//java file
public static final Connection getConnection() throws SQLException {
     try {
         Context env = (Context) new 
InitialContext().lookup("java:comp/env");
         DataSource ds = (DataSource) env.lookup("jdbc/test");
         if (ds==null)
             throw new SQLException("Cannot connect to mysql db test");
         return(ds.getConnection());
     }
     catch (NamingException ne) {
         throw new SQLException(ne.getMessage());
     }
}


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to