Skip to Main Content

Java Programming

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!

JDBC Connection Issues with MySQL

807606Feb 25 2007 — edited Feb 25 2007
Afternoon everyone!

Newbie programmer here... I'm having an issue connecting to my mySQL driver. The following code...

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

public class Connect {

public static void main(String args[]) {
Connection con = null;

try {

Class.forName("com.mysql.jdbc.Driver").newInstance();

} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}
}
}

Gives me...

init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\SeanKSmith\HeadFirstJava\Chapter1\XPCManagementApplication\build\classes
compile:
run:
Exception: com.mysql.jdbc.Driver
BUILD SUCCESSFUL (total time: 0 seconds)


Do I have something setup wrong with my java environment? Any help would be greatly appreciated. Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 25 2007
Added on Feb 25 2007
16 comments
948 views