in fase di compilazione non mi da errori, ma in esecuzione ritorna sempre "Mysql device driver does not exist" .... Class.forName sbagliate per mysql?Codice PHP:
import java.sql.*;
class Retrieve
{
public static void main (String args[])
{
try
{
try
{
Class.forName("com.mysql.jdbc.Driver");
}
catch (ClassNotFoundException e)
{
System.out.println("Mysql device driver does not exist");
System.exit(1);
}
Connection conn = DriverManager.getConnection("jdbc:mysql://0.0.0.0:0/users_table?user=user&password=password");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select username, password from users");
while (rset.next())
{
System.out.println(rset.getString(1)+" "+rset.getString(2));
}
rset.close();
stmt.close();
conn.close();
}
catch (SQLException e)
{
System.out.println("error accesing DataBase");
System.out.println("error code is: "+e.getErrorCode());
System.out.println("error message is: "+e.getMessage());
}
}
}