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
|
RowSet jdbcRs= new JdbcRowSetImpl();
jdbcRs.setUsername("root");
jdbcRs.setPassword("");
jdbcRs.setUrl("jdbc:mysql://localhost:3306/hypermarche");
jdbcRs.setCommand("SELECT count(*) AS res FROM membres");
jdbcRs.execute();
/*
FONCTIONNE BIEN AVEC CE CODE
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/hypermarche", "root", "");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT count(*) AS res FROM membres");
while (rs.next())
{
String resultat = rs.getString("res");
label.setText(resultat);
}
con.close();
*/ |
Partager