Advertisement
Guest User

Untitled

a guest
Apr 28th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package stock;
  7.  
  8. import com.mysql.cj.jdbc.Driver;
  9. import java.sql.*;
  10. import java.util.Scanner;
  11.  
  12. /**
  13. *
  14. * @author home
  15. */
  16. public class Stock {
  17.  
  18. /**
  19. * @param args the command line arguments
  20. */
  21. public static void main(String[] args) {
  22. System.out.println("voici le stock actuelle ");
  23. try {
  24. Class.forName("com.mysql.cj.jdbc.Driver");
  25. Connection con = DriverManager.getConnection(
  26. "jdbc:mysql://localhost:3306/Stock?useLegacyDatetimeCode=false&serverTimezone=America/New_York", "root", ""
  27. );
  28. //here sonoo is database name, root is username and password
  29. Statement stmt = con.createStatement();
  30. ResultSet rs = stmt.executeQuery("select * from project_appjava");
  31. while (rs.next()) {
  32. System.out.println(rs.getInt(1) + " " + rs.getString(2) + " " + rs.getString(3));
  33. }
  34. con.close();
  35. } catch (Exception e) {
  36. System.out.println(e);
  37.  
  38. } // TODO code application logic here
  39. System.out.println("[V] Vendre produits ");
  40. System.out.println("[C] Commande produits ");
  41. System.out.println("Opération à faire : ");
  42. Scanner sc = new Scanner(System.in);
  43. String valeur = sc.nextLine();
  44. if (valeur.equals("v")|| valeur.equals("V"))
  45. {
  46. vendre();
  47. }
  48. else if (valeur.equals("c")|| valeur.equals("C"))
  49. {
  50. command();
  51. }
  52. }
  53.  
  54. public static void vendre(){
  55.  
  56. }
  57.  
  58. public static void command(){
  59.  
  60. }
  61.  
  62.  
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement