Bonjour,
le sujet date un peu.
De mon coté j'ai un problème un peu similaire.
J'ai ce code qui marche pour me connecter a local host:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| import java.sql.*;
public class Principale {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String url = "jdbc:mysql://localhost";
String user = "root";
String passwd = "";
Connection maConnexion;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
maConnexion= DriverManager.getConnection(url, user, passwd);
System.out.println("maConnexion vaut "+ maConnexion );
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("FUCKK!!!!!");
}
}
} |
Mais dès que je veux me connecter a ma base nommée basetest
String url = "jdbc:mysql://localhost/basetest";
Boum! erreur!
D'origine j'ai d'autre bases dans phpmyadmin, et je peux m'y connecter sans erreurs. De meme pour une autre base vide que j'ai créé.
J'ai aussi essayer de renommer la base, et le probleme est resté.
J'ai mal du configurer quelque chose, mais quoi???
Partager