Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package controller;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class Conexion {
- Connection conexion;
- public Conexion() {
- conexion = null;
- }
- public String conectar() throws ClassNotFoundException, SQLException {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- conexion = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "NombreDB", "MiClave");
- if (conexion != null) {
- return "Conectado";
- } else {
- return "Sin conexion";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement