Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import java.sql.DriverManager;
  2. import java.sql.SQLException;
  3.  
  4. /**
  5.  * @author esyrss@gmail.com
  6.  * @author sin_querer@hotmail.com
  7.  */
  8. public class Conexion {
  9.     private static Connection cn = null;
  10.     private static String URL = "jdbc:mysql://localhost:3306/miprueba";
  11.     private static String usuario = "root";
  12.     private static String contrasena = "123456";
  13.     public static Connection getConexion() throws SQLException, ClassNotFoundException {
  14.         DriverManager.registerDriver(new com.mysql.jdbc.Driver());
  15.         cn = DriverManager.getConnection(URL, usuario, contrasena);
  16.         return cn;
  17.     }
  18. }