Salut les gens,
Je commence en java alors soyez gentils plzzzzz :-)
J'essai de me connecter a ma base de donner Mysql en passant par un programme en java développé sous eclipse dont voici le code :
import java.sql.*;
class affichage{
public static void main(String[] args){
String pilote = "com.mysql.jdbc.Driver";
try{
Class.forName(pilote);
Connection connexion = DriverManager.getConnection("jdbc:mysql://localhost/test","root","pass");
Statement instruction = connexion.createStatement();
ResultSet resultat = instruction.executeQuery("SELECT * FROM ANNONCE");
while(resultat.next()){
System.out.println("---------------------------");
System.out.println("N° ID_ANNONCE: "+resultat.getInt("ID_ANNONCE"));
System.out.println("N° ID_MODELE: "+resultat.getInt("ID_MODELE"));
System.out.println("Descriptif: "+resultat.getString("DESCRIPTIF"));
}
}
catch (Exception e){
System.out.println("echec pilote : "+e);
}
}
}
Il me semble avoir bien placer mes pilote mysql mais je suis pas sur ( je les ais mis la où il y a mon code java).
Et voici ce que cela m'affiche :
echec pilote : java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Auriez-vous une solution a me proposé siouplé.