• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

mysql-jdbc connection problem

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have installed mysql i am running win2000pro.
i am trying to make a small applet to connect to a database named people; so far i havent gotten much success.
the problem is with the driver.
i downloaded the .jar file mm.mysql-2.0.14
i placed this file in the following directory:
c:\mysql\mm.mysql-2.0.14.jar
i then set my classpath to this in a DOS prompt:
set classpath=.;c:\mysql\mm.mysql-2.0.14.jar;%classpath%
here is the code so far:
///////////////////////////////////////////////
import java.sql.*;
public class Lookup{
public static void main(String[] args) throws SQLException, ClassNotFoundException{
String url = "jdbc:mysql://localhost/people";
String user = "";
String password = "";

Class.forName("org.gjt.mm.mysql.Driver");
Connection c = DriverManager.getConnection(url,user,password);
}
it will compile with no errors. when i run
java Lookup it gives me the error:
exeption in thread "main" java.lang.ClassNotFoundException rg.gjt.mm.mysql.Driver
thanks in advance for any help.
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess your problem is that you did not put the binary jarfile of your MM MySQL Driver to the classpath. You used the the source-jar instead. The binary must be named something like:
mm.mysql-2.0.14-bin.jar.
If you only have this source jarfile you could compile it and add the resulting jar to your classpath.
You can also download the latest Driver-package from here.
The zipfile contains the binary jar called:
mysql-connector-java-2.0.14-bin.jar.
sl
Hartmut
 
reply
    Bookmark Topic Watch Topic
  • New Topic