Bonjour,
Lorque j'essaie de récuperer des données ou de modifier ma base de données il ne se passe rien.
Comment savoir si j y suis bien connecté ?
Voici mon code :
et
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 <% try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection( "jdbc:mysql://localhost/jerome?user=root&password=monmotdepasse"); } catch(Exception e){ out.println("Connection ratée: "+e); st = conn.createStatement(); rs = st.executeQuery("select * from binome;"); %> <% while(rs.next()) {%> <tr> <td><% String name = rs.getString("nom");%> <td><% String name2 = rs.getString("prenom");%> </tr> <% } } %>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <% try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection( "jdbc:mysql://localhost/jerome?user=root&password=lfdap2000"); } catch(Exception e){ out.println("Connection ratée: "+e); st = conn.createStatement(); rs = st.executeQuery("create jsp(nom VARCHAR(20));"); %>
Partager