Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 Conexion;
- import java.sql.Connection;
- import java.sql.DriverManager;
- /**
- *
- * @author Consultor
- */
- public class Conexion {
- public static Connection getConexion()
- {
- Connection connection = null;
- try
- {
- String driverClassName = "com.mysql.jdbc.Driver";
- String driverUrl = "jdbc:mysql://localhost/dsybd";
- Class.forName(driverClassName);
- connection = DriverManager.getConnection(driverUrl, "root", "");
- System.out.println("Conexion exitosa.");
- } catch(Exception e)
- {
- e.printStackTrace();
- System.out.println("Hubo un error");
- }
- return connection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement