Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package unsch.efpis.ConexionDB;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.Driver;
  5. import java.sql.DriverManager;
  6. import java.sql.SQLException;
  7.  
  8. /**
  9.  *
  10.  * @author sin_querer
  11.  */
  12. public class Conexion {
  13.     private static Connection cn = null;
  14.     private static Driver driver = new oracle.jdbc.OracleDriver();
  15.     private static String URLOracle = "jdbc:oracle:thin:@localhost:1521:XE";
  16.     private static String usuario = "system";
  17.     private static String contrasena = "123456";
  18.    
  19.     public static Connection getConexion() throws SQLException {
  20.         DriverManager.registerDriver(driver);
  21.         cn = DriverManager.getConnection(URLOracle, usuario, contrasena);
  22.         return cn;
  23.     }
  24. }