मैं कोड के इस स्निपेट का उपयोग करने का सुझाव देता हूं
private String jdbcDriver = "com.mysql.jdbc.Driver";
private String dbAddress = "jdbc:mysql://localhost:3306/TIGER?createDatabaseIfNotExist=true";
private String userName = "root";
private String password = "";
private PreparedStatement statement;
private ResultSet result;
private Connection con;
public DbStuff() {
try {
Class.forName(jdbcDriver);
con = DriverManager.getConnection(dbAddress, userName, password);
}
catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}