Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package stock;
- import com.mysql.cj.jdbc.Driver;
- import java.sql.*;
- import java.util.Scanner;
- /**
- *
- * @author home
- */
- public class Stock {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- System.out.println("voici le stock actuelle ");
- try {
- Class.forName("com.mysql.cj.jdbc.Driver");
- Connection con = DriverManager.getConnection(
- "jdbc:mysql://localhost:3306/Stock?useLegacyDatetimeCode=false&serverTimezone=America/New_York", "root", ""
- );
- //here sonoo is database name, root is username and password
- Statement stmt = con.createStatement();
- ResultSet rs = stmt.executeQuery("select * from project_appjava");
- while (rs.next()) {
- System.out.println(rs.getInt(1) + " " + rs.getString(2) + " " + rs.getString(3));
- }
- con.close();
- } catch (Exception e) {
- System.out.println(e);
- } // TODO code application logic here
- System.out.println("[V] Vendre produits ");
- System.out.println("[C] Commande produits ");
- System.out.println("Opération à faire : ");
- Scanner sc = new Scanner(System.in);
- String valeur = sc.nextLine();
- if (valeur.equals("v"))
- {
- vendre();
- }
- }
- public static void vendre(){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement