Advertisement
Guest User

Untitled

a guest
Aug 30th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. package jdbc;
  2.  
  3.  
  4. import java.sql.Connection;
  5. import java.sql.DriverManager;
  6. import java.sql.SQLException;
  7.  
  8.  
  9. public class Conexao {
  10. public static Connection receberConexao(){
  11.  
  12. Connection con = null;
  13.  
  14.  
  15. try {
  16. con = DriverManager.getConnection("jdbc:mysql://localhost:3306/bancodadosempresa", "root", "");
  17. System.out.println("COnexão efetuada com sucesso! ");
  18.  
  19. } catch (SQLException e) {
  20. // TODO Auto-generated catch block
  21. e.printStackTrace();
  22. }
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. return con;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement