Advertisement
Guest User

connexion florianus

a guest
Nov 22nd, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Connection connection = null;
  2. Statement rapport = null;
  3. ResultSet resultat = null;
  4.  
  5. public Connexion() throws ClassNotFoundException, SQLException {
  6. Class.forName("com.mysql.jdbc.Driver");
  7. System.out.println("Driver OK...");
  8.  
  9. String url = new String ("jdbc:mySql://localhost/alimentation");
  10.  
  11. connection = DriverManager.getConnection(url, "root","");
  12. System.out.println("Connexion Réussie !");
  13.  
  14. rapport = (Statement) connection.createStatement();
  15. }
  16.  
  17. public ResultSet afficherGroupe() throws SQLException{
  18. return rapport.executeQuery("SELECT * FROM `groupe`");
  19. }
  20.  
  21. public ResultSet LireLesSousGroupes(int choix) throws SQLException {
  22. return rapport.executeQuery("SELECT * FROM `sous_groupe` WHERE grp_id = " + choix);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement