Advertisement
Guest User

Untitled

a guest
May 18th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. package cadastroMiad_certo.banco;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.SQLException;
  6.  
  7. /**
  8. *
  9. * @author Sandro Softwares
  10. */
  11. public class CriaConexao {
  12.  
  13. public static Connection getConexao() throws SQLException {
  14.  
  15.  
  16. try {
  17. Class.forName("com.mysql.jdbc.Driver");
  18. System.out.println("Conectando ao banco...");
  19.  
  20. return DriverManager.getConnection("jdbc:mysql://localhost/miad_certo", "root", "senha");
  21. } catch (ClassNotFoundException e) {
  22. System.out.println("erro");
  23. throw new SQLException(e.getMessage());
  24.  
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement