Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. Connection connexion = DriverManager.getConnection("jdbc:mysql://localhost:3306/bd","root","ali");
  2.  
  3. Statement instruction = connexion.createStatement();
  4.  
  5. ResultSet resultat = instruction.executeQuery("SELECT date, count(*) as nb FROM traprecive group by date");
  6.  
  7. aliMap=new LinkedHashMap<String, Float>();
  8.  
  9. //Remplissage de la map
  10. while(resultat.next())
  11. {
  12. aliMap.put(resultat.getDate(1), Float.valueOf(resultat.getFloat(2)));
  13. }
  14.  
  15. //Affichage du contenu de la map
  16. Iterator<Date> itKeys=aliMap.keySet().iterator();
  17. while(itKeys.hasNext())
  18. {
  19. String key=itKeys.next();
  20. System.out.println(key.toString()+" "+aliMap.get(key));
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement