Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package m03.uf5.p01.grup5.gestioHospital.utils;
- import java.io.FileInputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.PreparedStatement;
- import java.sql.SQLException;
- import java.util.Properties;
- public class ConexionDB {
- public static String url = "jdbc:mysql://localhost:3308/mysql?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC ",
- usuario = "root",
- pass = "admin";
- public static Connection contectar(){
- Connection conexion = null;
- try{
- conexion = DriverManager.getConnection(url,usuario,pass);
- System.out.println("Conexión establecida");
- }catch (Exception e){
- System.out.println("Error de conexión a la BD en ConexionDB.java");
- System.out.println(e.getMessage());
- }
- return conexion;
- }
- public PreparedStatement prepareStatement(String select__from_malalties) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- }
- ---
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package m03.uf5.p01.grup5.gestioHospital.utils;
- /**
- *
- * @author Raul Barrero
- */
- public class Connec {
- public static void main(String[] args) {
- ConexionDB conexio = new ConexionDB();
- conexio.contectar();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement