This commit is contained in:
David 2024-05-05 18:43:23 -06:00
parent 285050f3ea
commit 8804302b6f
1 changed files with 22 additions and 1 deletions

View File

@ -1,5 +1,26 @@
package mx.uv;
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;
}
}