You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christian Bockerman <ch...@bockermann.ping.de> on 2002/05/02 11:06:56 UTC

Re: what is needed to connect to mysql

Hi !

On Thu, May 02, 2002 at 02:09:09AM -0700, # Lalit Nagpal # wrote:
> 
> hello,
> 
> plz can anybody tell me how to connect to a mysql database through
> a servlet. i know how to prepare a connection etc through code but
> what other settings are needed. i am using tomcat 4 as a standalone.
> 
> The error i get is "Class not found org.gjt.mm.mysql.Driver"
>

As the message says, the classloader cannot find the mysql-driver
class. I guess your having something like

  Driver DriverRecordSet1 = (Driver)Class.forName("org.gjt.mm.mysql.Driver").newInstance();

in your code. Now imagine that your classloader wants to load a class.
There are a few places where he can look for it. Either the places
specified in your CLASSPATH-Variable or the predefined places of your
tomcat-installation. 
You can read about that in 
   http://jakarta.apache.org/tomcat/tomcat-4.0-doc/class-loader-howto.html

where it says that you should put your mysql-2.0.4.jar (or how it is
called) in $CATALINA_HOME/lib. This would share your mysql-classes across
all webapplications.

Hope this helps...

-Christian

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: what is needed to connect to mysql

Posted by # Lalit Nagpal # <la...@yahoo.com>.
 thanx christian,
prob was when i put a jar in the classpath it would not locate the classes. now when i have extracted the contents of mm driver and kept the extracted contents in the classpath .. everything works just fine.
Thanx anyway ...
  Christian Bockerman <ch...@bockermann.ping.de> wrote: Hi !

On Thu, May 02, 2002 at 02:09:09AM -0700, # Lalit Nagpal # wrote:
> 
> hello,
> 
> plz can anybody tell me how to connect to a mysql database through
> a servlet. i know how to prepare a connection etc through code but
> what other settings are needed. i am using tomcat 4 as a standalone.
> 
> The error i get is "Class not found org.gjt.mm.mysql.Driver"
>

As the message says, the classloader cannot find the mysql-driver
class. I guess your having something like

Driver DriverRecordSet1 = (Driver)Class.forName("org.gjt.mm.mysql.Driver").newInstance();

in your code. Now imagine that your classloader wants to load a class.
There are a few places where he can look for it. Either the places
specified in your CLASSPATH-Variable or the predefined places of your
tomcat-installation. 
You can read about that in 
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/class-loader-howto.html

where it says that you should put your mysql-2.0.4.jar (or how it is
called) in $CATALINA_HOME/lib. This would share your mysql-classes across
all webapplications.

Hope this helps...

-Christian

--
To unsubscribe: 
For additional commands: 
Troubles with the list: 


# Lalit Nagpal #


---------------------------------
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness