Hi!
Ich habe ein paar probleme mit meiner JDBC-Connection.
Ich habe Xampp installiert, auch einige neue User erstellt. Mein Problem ist, dass ich über Java nur eine Verbindung zu Mysql-Datenbank (welche auf dem localhost liegt) bekomme, wenn ich mich als root anmelde. Nicht jedoch als nicht-Admin.
Will ich mich bei der Online-Datenbank db4free.net anmelden, klappt alles wunderbar.
Hat jemand von euch eine Idee, wie ich das Problem lösen könnte?
Quelltext für die Connection:
public static Connection driver(String user, String pass) {
java.sql.Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://localhost/db1";
con = DriverManager.getConnection(url, user, pass);
} catch (ClassNotFoundException c) {
c.printStackTrace();
} catch (SQLException c) {
return null;
} catch (Exception e) {
e.printStackTrace();
}
return con;
}
Gebe ich nun root & passwort ein, so bekomme ich ne ganz normale Verbindung. Bei anderen Eingaben null.
Ich habe ein paar probleme mit meiner JDBC-Connection.
Ich habe Xampp installiert, auch einige neue User erstellt. Mein Problem ist, dass ich über Java nur eine Verbindung zu Mysql-Datenbank (welche auf dem localhost liegt) bekomme, wenn ich mich als root anmelde. Nicht jedoch als nicht-Admin.
Will ich mich bei der Online-Datenbank db4free.net anmelden, klappt alles wunderbar.
Hat jemand von euch eine Idee, wie ich das Problem lösen könnte?
Quelltext für die Connection:
public static Connection driver(String user, String pass) {
java.sql.Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://localhost/db1";
con = DriverManager.getConnection(url, user, pass);
} catch (ClassNotFoundException c) {
c.printStackTrace();
} catch (SQLException c) {
return null;
} catch (Exception e) {
e.printStackTrace();
}
return con;
}
Gebe ich nun root & passwort ein, so bekomme ich ne ganz normale Verbindung. Bei anderen Eingaben null.