Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

failed to mysql database

Thread view: 
boyScout - 24 Apr 2008 12:32 GMT
Hello guys, i'm trying to connect to a mysql database and i get this
error:

java.lang.ClassNotfoundException:com.mysql.jdbc.Driver

I've downloaded the mysql driver called mysql-connector-java-5.1.6-bin
and the driver directory is in the my CLASSPATH but still have the
same exception. What should i do? Thank you
Lew - 24 Apr 2008 12:40 GMT
> i'm [sic] trying to connect to a mysql database and i [sic] get this
> error:
>
> java.lang.ClassNotfoundException:com.mysql.jdbc.Driver

That is not the error you are getting.  It isn't the exception you are
getting, either.

> I've downloaded the mysql driver called mysql-connector-java-5.1.6-bin
> and the driver directory is in the my CLASSPATH but still have the
> same exception. What should i do? Thank you

To nail this down, don't use the CLASSPATH envar.  Use the -classpath (-cp)
option to the 'java' command.  If you get it right there, then you might, if
you are into maintenance difficulties, modify your CLASSPATH to match.

How exactly are you attempting to run the program?  Without knowing that it's
impossible to answer your question.

Signature

Lew

boyScout - 25 Apr 2008 09:16 GMT
I've tried to do what you suggested me but still it don't work, i'm
using easyphp and i was tring to connect to its mysql from a simple
java application to see how it will work, i've been using msaccess
database and i want to immigrate to mysql when i'm using java. And i
was tring for the first time to connect to mysql using java. However
i've placed the bin/ directory of java in the CLASSPATH but nothing,
same message.
Lew - 25 Apr 2008 12:39 GMT
> I've tried to do what you suggested me but still it don't work, i'm
> using easyphp and i was tring to connect to its mysql from a simple
[quoted text clipped - 3 lines]
> i've placed the bin/ directory of java in the CLASSPATH but nothing,
> same message.

The bin/ directory has *nothing* to do with the CLASSPATH.  The bin/ directory
is for executables; classpaths are for Java libraries.  Not even remotely the
same thing.

Read "Setting the Classpath"
<http://java.sun.com/javase/6/docs/technotes/tools/solaris/classpath.html>
<http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html>

Signature

Lew

Lew - 24 Apr 2008 12:47 GMT
> and the driver directory is in the my CLASSPATH

Not the JAR file itself?  You're supposed to put the JAR in your classpath.

Signature

Lew

Arne Vajhøj - 26 Apr 2008 01:19 GMT
> Hello guys, i'm trying to connect to a mysql database and i get this
> error:
[quoted text clipped - 4 lines]
> and the driver directory is in the my CLASSPATH but still have the
> same exception. What should i do? Thank you

What exactly is in your classpath ?

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.