SHARE
TWEET

Untitled

a guest May 21st, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //*******conexion*******//
  2.                 String url = "jdbc:mysql://localhost:3306/mibd";
  3.                 String user = "root";
  4.                 String pass = "";
  5.                 System.out.println("Conectando…");
  6.                 try(Connection connection = (Connection) DriverManager.getConnection(url, user,pass)){
  7.                 System.out.println("Conectado!!");
  8.                 //Agregamos el usuario
  9.                 Statement s = connection.createStatement();
  10.                 String query1 = "insert into datos (producto,cantidad,area, descripcion, unidad, fecha) value ('"+producto+"','"+cantidad+"','"+area+"','"+descripcion+"','"+unidad+"',NOW())";
  11.                 s.executeUpdate(query1);
  12.  
  13.                 }catch(SQLException e){
  14.                 System.out.println(e.getMessage());
  15.                 }
  16.                 //*******Conexión***********//
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top