Connexion à une base de données MySQL avec Java
bonjour , y a t'il quelqu'un qui peut m aider a resoudre c problem ;
j arrive pas a me connecter a ma base de donnée mysql a partir d une application java sur netbeans le code utiliser est ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| package helloword;
import java.sql.*;
public class helloword {
public static void main(String[] args) throws SQLException {
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Le pilote JDBC MySQL a été chargé");
Connection connexion = DriverManager.getConnection("jdbc:mysql://localhost/entrepot","root","");
Statement state = connexion.createStatement();
ResultSet result = state.executeQuery("SELECT * FROM customer");
while(result.next())
System.out.println(result.getInt(1)+" "+result.getString(2)+" "+result.getString(3)+" "+result.getString(4));
connexion.close();
} catch (Exception e) { System.out.println(e);}
}
} |
le msg d erreur est celui :
Code:
1 2 3 4
| run:
Le pilote JDBC MySQL a été chargé
java.sql.SQLException: java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long
BUILD SUCCESSFUL (total time: 1 second) |
svp vos aides