Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Urgent Assistance with JDBC needed

Hi

I have a program running the following java-code:

[code]
import java.io.*;
import java.sql.*;

public class MySQLTest {
private Connection conn;
public MySQLTest()
{
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql//localhost:3306/localhost?user=&password=");
}
catch(Exception cntEx)
{
System.out.println(cntEx);
}
try
{
Statement stmt=conn.createStatement();
String sql="select * from addressbook";
ResultSet rst=stmt.executeQuery(sql);
while (rst.next())
{
System.out.println(rst.getString(1));
}
}
catch(Exception ex)
{
System.out.println(ex);
}
}
public static void main(String[] args)
{
MySQLTest msql = new MySQLTest();
}
}
[/code]

The script compiles without any troubles at all, but then I try to run it the following error is displayed.

No Suitable driver.

I have setup the following CLASSPATH in My Windows XP installation.

C:Program FilesJavaj2re1.4.2_01libextmysql-connector-java-3.0.8-stable-bin.jar;

But I still get the error "No Suitable driver".

What am I doing wrong or what am I missing to setup???

/Fred
Sign In or Register to comment.