Problem connecting to driver
I'm trying to test my connection to the mysql driver, and i keep getting this message:
Exception in thread "main" java.lang.NoClassDefFounfError: Jdbc11
Jdbc11.java compiles ok.
I'm using
j2sdk1.4.2_08
mysql-connector-java-3.1.8a.tar
mysql-essential-4.1.11-win32
Wind XP
path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Fichiers communs\Adaptec Shared\System;C:\Program Files\MySQL\MySQL Server 4.1\bin;%JAVA_HOME%\bin
where JAVA_HOME = "C:\j2sdk1.4.2_08"
and i also created a variable CLASSPATH = "C:\mennen\downloads\connectorJ\mysql-connector-java-3.1.8a.tar"
I also put the mysql-connector-java-3.1.8a.tar in the C:\j2sdk1.4.2_08\jre\lib\ext directory.
I've tried a lot of things i've read on forums, but it just doesn't wanna work
I also tried executing it with
java -cp .;\C:\mennen\downloads\connectorJ\mysql-connector-java-3.1.8a.jar Jdbc11
but it still won't work!
Here is Jdbc11.java
_____________________________________________________________________
import java.sql.*;
public class Jdbc11 {
public static void main(String args[]){
System.out.println(
"Mennen ELKALYOUBI testing..");
try {
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/mysql";
Connection con =DriverManager.getConnection(url,"root", "mennen"); //mennen is the password i use when i log onto mysql
System.out.println("URL: " + url);
System.out.println("Connection: " + con);
con.close();
}
catch (java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}}
___________________________________________________________________
Please help!!
Subject
Written By
Posted
Problem connecting to driver
May 17, 2005 09:49AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.