File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes connector/J with my SQL.. Driver fails to load! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connector/J with my SQL.. Driver fails to load!" Watch "connector/J with my SQL.. Driver fails to load!" New topic
Author

connector/J with my SQL.. Driver fails to load!

Gul Khan
Ranch Hand

Joined: Sep 03, 2003
Posts: 173
Hi all
I am trying to use connector/J driver for MySQL with Tomcat. I have copied the jar file in to the ~home~/common/lib folder and added the jar file to the classpath. When i try to connect through the following code get "Driver not loaded exception".... please anyone would tell me whats wrong here?
Code in my servlet----->
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
envCtx.lookup("jdbc/database");
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
<----------------------------->
Following is the the entry in my server.xml under <context>

server.xml!
<--------------------------------------------->
<Resource name="jdbc/<database name>" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/<databsename>">
<parameter>
<name>username</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>url</name>
<value>jdbc:mysql://localhost/<databasename></value>
</parameter>
<parameter>
<name>maxActive</name>
<value>8</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>4</value>
</parameter>
</ResourceParams>
------------------------------------------>
Bestest of Regards
pervaiz gul
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connector/J with my SQL.. Driver fails to load!
 
Similar Threads
JNDI in webapps
Pooling w/Tomcat 5 - Oracle
Cannot create JDBC driver
Datasource Problem
Tomcat Database Connection Pooling Error