No suitable error ?
Posted by: pompelmo
Date: October 18, 2004 01:55AM

I am running mysql and Jconnector on a gentoo.
I have this code

import java.sql.*;

public class database {
private Connection connection;
private String driverName;
private String serverName;
private String mydatabase;
private String url;
private String username;
private String password;
private Statement stmt;
private ResultSet rs;

database() {
this.connection = null;
//try { this.connection.setReadOnly(true); } catch (SQLException e) { };
this.stmt = null; = null;
this.driverName = ""; // MySQL MM JDBC driver
try { Class.forName(this.driverName); } catch (ClassNotFoundException e) { };
this.mydatabase = "*****";
this.url= "jdbc:mysql://" + serverName + "/" + mydatabase;
this.username = "****";
this.password = "****";

private void connetti() {

try {

this.connection = DriverManager.getConnection(this.url, this.username, this.password);

} catch (SQLException e) {
// Could not connect to the database
System.out.println("Can't connect to database.\nError: " +e);

and this is the error:

Can't connect to the database.
Error: java.sql.SQLException: No suitable driver

Of course the database name, user and password are correct and i put my jconnector on:
Near others jar classes....what is the problem?

Note: this code on win32 worked

Options: ReplyQuote

Written By
No suitable error ?
October 18, 2004 01:55AM
October 18, 2004 07:32AM
October 24, 2004 07:14PM

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.