tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From # Lalit Nagpal # <lalit_tom...@yahoo.com>
Subject Re: what is needed to connect to mysql
Date Fri, 03 May 2002 05:04:06 GMT

 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 <chris@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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message