From 8804302b6fce6f7f2bd6ad0ed60d55c703dc42fd Mon Sep 17 00:00:00 2001 From: David Date: Sun, 5 May 2024 18:43:23 -0600 Subject: [PATCH] Conexion --- .../src/main/java/mx/uv/Conexion.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/healthmanager_back/src/main/java/mx/uv/Conexion.java b/healthmanager_back/src/main/java/mx/uv/Conexion.java index f2671db..b03ca2b 100644 --- a/healthmanager_back/src/main/java/mx/uv/Conexion.java +++ b/healthmanager_back/src/main/java/mx/uv/Conexion.java @@ -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; + } }