![Citation](https://forum.developpez.be/images/misc/quote_icon.png)
Envoyé par
anonyme13
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
|
<%@ page import="java.sql.*" %>
<%
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con=null;
if(con!=null){
out.println("connexion etablie");
}
else{
out.println("connexion echouée");
}
String URL ="jdbc:mysql//localhost:8080/personne?user=root";
con = DriverManager.getConnection(URL);
PreparedStatement st = con.prepareStatement("insert into person (nom,prenom) values(name,lastname)");
st.executeUpdate();
con.close();
st.close();
}catch(Exception e){
out.print(e.getMessage());
} |
l'erreur est la suivante :
1 2
|
connexion echouée:calim2: No suitable driver found for jdbc:mysql//localhost:8080/personne?user=root |
Comme l'a dit rafikfree, fais gaffe t'as oublié ":" dans ton URL après mysql :
String URL ="jdbc:mysql://localhost:8080/personne?user=root";
ensuite oui , pour la librairie, tu as bien ajouté ton jar à ton classpath?
Partager