Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tbanco.dao;
- import java.sql.*;
- public class DAO {
- protected Connection conn;
- protected Statement state;
- protected ResultSet result;
- protected final String DRIVER = "jdbc:oracle:thin:USUÁRIO/SENHA@//localhost:1521/XE";
- protected final String JDBC = "oracle.jdbc.OracleDriver";
- protected String lastErrorMessage = "";
- // <editor-fold defaultstate="collapsed" desc="Connect/Disconnect">
- protected boolean connect() {
- boolean success = false;
- try {
- Class.forName(JDBC);
- conn = DriverManager.getConnection(DRIVER);
- state = conn.createStatement();
- success = true;
- } catch (ClassNotFoundException | SQLException e) {
- /* getMessage getErrorCode */
- }
- return success;
- }
- protected boolean disconnect() {
- boolean success = false;
- try {
- conn.close();
- success = true;
- } catch (SQLException e) {
- /* getMessage getErrorCode */
- }
- return success;
- }
- public String getLastErrorMessage() {
- return lastErrorMessage;
- }
- // </editor-fold>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement