Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Mysql driver and Jbuilder 2005 foundation

843804Apr 14 2005 — edited Apr 19 2005
I am trying to connect to a mysql server using jdbc and the mysql drivers. Specifically version 3.1.7. I will post my code here although I believe the code is correct and that I have a classpath issue with jbuilder. The error I am receiving on both build and run time is:

Exception in thread "main" java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at methodclassespkg.DummyTester.main(DummyTester.java:39)

I installed the mysql .jar driver file in the jdk1.5/lib/ext as the read me file that came with the drivers stated. I have changed the default jdk to the jdk1.5 update 2 that I installed. I imoprted the .jar driver file into the project and even added the file under tools/configure/libraries. But I still receive this error witht his code


package methodclassespkg;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import java.io.*;


/*
Class Name: Dummy Tester Class
Description: A dummy class with a main to test the other classes functionality.
Company: Team SSJ (7)

Copyright (c) 2005
Version 1.0
*/

public class DummyTester {
public DummyTester() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}

public static void main(String[] args) throws SQLException, IOException{
try{

Class.forName("com.mysql.jdbc.Driver");
}
catch(ClassNotFoundException e){
System.out.println("Could not load the driver");
}

Connection conn = DriverManager.getConnection("ServerName", "user", "password");

System.out.println("test");
}

private void jbInit() throws Exception {
}

}

Again I am running the free version which does not allow me to access the enterprise tab, I mention this because I saw a solution to this issue that allowed for importing the database driver using tools/enterprisesetup/database drivers. but I do not have access to this functionalitity.

Jeremy Reed
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 17 2005
Added on Apr 14 2005
3 comments
163 views