Advertisement
Guest User

Untitled

a guest
Mar 8th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package it.cineca.alt;
  2. import java.sql.SQLException;
  3.  
  4.  
  5. public class Main {
  6. public static void main(String[] args) throws SQLException {
  7.  
  8. ConnectionFactory cf = new ConnectionFactory("jdbc:mysql://localhost:3306/sakila", "root", "alternanza");
  9.  
  10. try {
  11. Class.forName("com.mysql.jdbc.Driver");
  12. Dao d = new Dao(cf.getConnection());
  13.  
  14. Persona p = new Persona(5 , "pietro", "fu", "fuuu", "123", new java.sql.Timestamp(new java.util.Date().getTime()));
  15. d.insertPersona(p);
  16. d.getPersona(1);
  17. } catch (Exception e) {
  18. e.printStackTrace();
  19. }
  20. finally {
  21. cf.close();
  22.  
  23. }
  24. }
  25.  
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement