Advertisement
Guest User

Untitled

a guest
Feb 28th, 2018
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. package demo;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.ResultSet;
  6. import java.sql.ResultSetMetaData;
  7. import java.sql.SQLException;
  8. import java.sql.Statement;
  9.  
  10. public class Main {
  11. public static void main(String[] args) throws SQLException {
  12.  
  13. ConnectionFactory cf = new ConnectionFactory("jdbc:mysql://localhost:3306/sakila", "root", "alternanza");
  14.  
  15. try {
  16. Class.forName("com.mysql.jdbc.Driver");
  17. Dao d = new Dao(cf.getConnection());
  18. d.execute();
  19. } catch (Exception e) {
  20. e.printStackTrace();
  21. }
  22. finally {
  23. cf.close();
  24. }
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement