Conexion.java.txt

download Conexion.java.txt

of 1

Transcript of Conexion.java.txt

  • 5/24/2018 Conexion.java.txt

    1/2

    /** To change this template, choose Tools | Templates* and open the template in the editor.*/package Conexion;import java.sql.*;

    /**** @author Dylan*/

    public class ConexionOracle { public Connection con = null;

    public ConexionOracle(){ try{ Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","DYLANC","dylan"); }catch(Exception exception){ exception.printStackTrace(); } }

    public Connection iniciarConexion(){ System.out.println("Conexion establecida con xito.");return con;

    }

    public void cerrarConexion(){try {

    con.close();} catch (SQLException e) {

    }}

    }

  • 5/24/2018 Conexion.java.txt

    2/2