Advertisement
Guest User

Untitled

a guest
Sep 24th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. package br.com.presentesempalavras.contatos;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.SQLException;
  6.  
  7. public class ConnectionFactory {
  8.  
  9. public Connection getConnection() throws SQLException {
  10. System.out.println("conectando ...");
  11.  
  12. try {
  13. Class.forName("com.mysql.jdbc.Driver");
  14. } catch (ClassNotFoundException e) {
  15. throw new SQLException(e);
  16. }
  17.  
  18. return DriverManager.getConnection("jdbc:mysql://localhost/presentesempalavras",
  19. "root", "");
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement