Conexion
This commit is contained in:
parent
285050f3ea
commit
8804302b6f
|
@ -1,5 +1,26 @@
|
||||||
package mx.uv;
|
package mx.uv;
|
||||||
|
|
||||||
public class Conexion {
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Connection;
|
||||||
|
|
||||||
|
public class Conexion {
|
||||||
|
public static String url="mysql://root:tdPXEKculfAIumCBQirpMvZYXnrOuCbZ@monorail.proxy.rlwy.net:51101/railway";
|
||||||
|
public static String Drivername="com.mysql.cj.jdbc.Driver";
|
||||||
|
public static String username="root";
|
||||||
|
public static String password="tdPXEKculfAIumCBQirpMvZYXnrOuCbZ";
|
||||||
|
|
||||||
|
private static Connection conexion=null;
|
||||||
|
|
||||||
|
public static Connection getConnection(){
|
||||||
|
try {
|
||||||
|
Class.forName(Drivername);
|
||||||
|
conexion = DriverManager.getConnection(url, username, password);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
System.out.println(" SQL:" + e);
|
||||||
|
} catch (ClassNotFoundException e){
|
||||||
|
System.out.println("Driver:" + e);
|
||||||
|
}
|
||||||
|
return conexion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue