je vais mettre le code peut etre que quelqu'un trouvera une solution.
import java.sql.*;
public class ConnectMysql {
public static void main(String args[]) {
String url,user,pwd;
url="jdbc:mysql://<site>/<base>";
user="<user>";
pwd="<pass>";
String requete = " SELECT contrat FROM contrat ";
try {
Class.forName("org.gjt.mm.mysql.Driver" );
}catch (java.lang.ClassNotFoundException e) {
System.out.println("ClassNotFoundException: " + e.getMessage());
}
try {
Connection con;
Statement stmt;
con = DriverManager.getConnection(url,user,pwd);
System.out.println(requete);
stmt = con.createStatement();
ResultSet rs = (ResultSet) stmt.executeQuery(requete);
while (rs.next()) {
String s = rs.getString("contrat" );
System.out.println(s);
}
stmt.close();
con.close();
}catch(SQLException ex) {
System.out.println("==> SQLException: "+ ex.getMessage ());
}
}
}