2 messages in com.mysql.lists.javaRe: Creating a DataSource and Connect...
FromSent OnAttachments
Arul08 Oct 2002 07:28 
Niclas Hedhman08 Oct 2002 18:59 
Subject:Re: Creating a DataSource and Connection in Tomcat for MYsql Database
From:Niclas Hedhman (nic@ewarna.com)
Date:10/08/2002 06:59:19 PM
List:com.mysql.lists.java

On Tuesday 08 October 2002 22:29, Arul wrote:

Hi All

I had created a DataSource in Tomcat Admin Console. But i am not getting a connection

ds.getConnection()

results in error. The error is java.sql.SQLException : cannot load JDBC Driver class null

But while creating the datasource i had given the driverclassname as org.gjt.mm.mysql.Driver

You say "name", are you talking about a String name, or the class itself?

What could be going wrong

If you can load the class explicitly,

Class c = org.gjt.mm.mysql.Driver.class;

You probably have a security issue.

But the error message is pointing in the more like direction that the class is not available to the classloader.

It depends on your Tomcat setup where you should place it. If you have a "permanent" use of MySQL in your Tomcat applications, you should perhaps keep a centralized copy in $TOMCAT_HOME/lib/. If not, it should be inside the WAR file's WEB-INF/lib/ directory.

Good luck.