public DataBaseManagement(String driver, String dbURL) { try { this.dbURL = dbURL; Class.forName(driver).newInstance(); conn = DriverManager.getConnection(dbURL); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | SQLException e) { // TODO Auto-generated catch block if (e instanceof SQLException) { SQLException sqle = (SQLException) e; if (sqle.getSQLState().equals("XJ040")) { sqle = sqle.getNextException(); if (sqle.getSQLState().equals("XSDB6")) { logger.error(sqle.getMessage() + " Please shutdown that other instance of Derby."); } } } else { CustomException.errorPrint(e); } } }
@Override public void run() { // TODO Auto-generated method stub try { dropAllTables(); createTables(); } catch (SQLException e) { // TODO Auto-generated catch block CustomException.errorPrint(e); } }