Example usage for java.sql DriverManager getConnection

List of usage examples for java.sql DriverManager getConnection

Introduction

In this page you can find the example usage for java.sql DriverManager getConnection.

Prototype

private static Connection getConnection(String url, java.util.Properties info, Class<?> caller)
            throws SQLException 

Source Link

Usage

From source file:controladores.controladorEmpleados.java

private Connection getConexion() {
    if (this.conexion == null) {
        try {/*from ww w. j av a 2  s . c om*/
            DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
            this.conexion = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system",
                    "javaoracle");
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
    return this.conexion;
}