Advertisement
Guest User

Untitled

a guest
Apr 16th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.SQLException;
  4.  
  5. public class Conexion {
  6.  
  7. private static Conexion conexion;
  8. private Connection conection;
  9.  
  10. private Conexion() {
  11. }
  12.  
  13. public Connection conectar() throws SQLException {
  14.  
  15. conection = null;
  16.  
  17. conection = DriverManager.getConnection(
  18. "jdbc:mysql://127.0.0.1:3306/prueba_borja?useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC",
  19. "root", "");
  20.  
  21. return conection;
  22.  
  23. }
  24.  
  25. public static Conexion getInstance() {
  26. if (conexion == null) {
  27. conexion = new Conexion();
  28. }
  29. return conexion;
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement