Skip to Main Content

Java Database Connectivity (JDBC)

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!

No Suitable Driver

843854Apr 6 2005 — edited Apr 6 2005
I have done a few apps now that talk to MySQL and this one is giving me a pain. I load the driver fine with this code:
// load driver
        try
        {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
        }
        catch(Exception ex)
        {
            JOptionPane.showMessageDialog(home,
                    "Drivers could not load",
                    "Driver Error",
                    JOptionPane.ERROR_MESSAGE);
        }
and then when I try to get the connection I get a No Suitable Driver error. This is code (minus username and pass):
// connect
        try
        {
            Connection conn=DriverManager.getConnection(
                    "jdbc:mysql://db.piratehook.com","*****","********");
          
            // Do something with the Connection
        }
        catch(SQLException ex)
        {
            JOptionPane.showMessageDialog(home,
                    "SQLException: "+ex.getMessage()+"\n"+
                    "SQLState: "+ex.getSQLState()+"\n"+
                    "VendorError: "+ex.getErrorCode(),
                    "SQL Error",
                    JOptionPane.ERROR_MESSAGE);
        }
any ideas?

Thx,
Duck Man
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 4 2005
Added on Apr 6 2005
3 comments
142 views