Advertisement
Guest User

Untitled

a guest
Apr 4th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. package Conectar;
  2.  
  3. import java.sql.*;
  4. public class ConexionBD {
  5.  
  6.  
  7. Connection conectar=null;
  8. public Connection getConexionBD(){ //metodo
  9. try {
  10. Class.forName("com.mysql.jdbc.Driver");
  11. conectar=DriverManager.getConnection("jdbc:mysql://localhost/bdhospital","root","");
  12.  
  13. } catch (Exception e) {
  14. System.out.println("No es posible conectar a la base de datos ");
  15. System.out.print(e.getMessage());
  16. }
  17. return conectar;
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement