protected void applySecurityToGFE(Connection gConn, String sql) { Log.getLogWriter().info("execute authorization statement in GFE"); Log.getLogWriter().info("security statement is: " + sql); try { Statement stmt = gConn.createStatement(); stmt.execute(sql); // execute authorization } catch (SQLException se) { if (se.getSQLState().equals("42506") && SQLTest.testSecurity) Log.getLogWriter() .info("Got the expected exception for authorization," + " continuing tests"); else if (se.getSQLState().equals("42509") && SQLTest.testSecurity) Log.getLogWriter() .info( "Got the expected grant or revoke operation " + "is not allowed exception for authorization," + " continuing tests"); else if (se.getSQLState().equals("42Y03") && hasRoutine) Log.getLogWriter() .info( "Got the expected not recognized as " + "a function or procedure exception for authorization," + " continuing tests"); else SQLHelper.handleSQLException(se); } }
public static void main(String args[]) { try { String urlBD = "jdbc:odbc:FOSA"; String usuarioBD = "SYSDBA"; String passwordBD = "masterkey"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conexion = DriverManager.getConnection(urlBD, usuarioBD, passwordBD); Statement select = conexion.createStatement(); ResultSet resultadoSelect = select.executeQuery("SELECT MAX(NUM_REG) AS numreg FROM FACT01"); System.out.println("COMANDO EXITOSO"); System.out.println("numreg"); System.out.println("------"); int col = resultadoSelect.findColumn("numreg"); for (boolean seguir = resultadoSelect.next(); seguir; seguir = resultadoSelect.next()) System.out.println(resultadoSelect.getInt(col)); resultadoSelect.close(); select.close(); conexion.close(); } catch (SQLException ex) { System.out.println("Error: SQLException"); while (ex != null) { System.out.println( (new StringBuilder()).append("SQLState: ").append(ex.getSQLState()).toString()); System.out.println( (new StringBuilder()).append("Mensaje: ").append(ex.getMessage()).toString()); System.out.println( (new StringBuilder()).append("Vendedor: ").append(ex.getErrorCode()).toString()); ex = ex.getNextException(); System.out.println(""); } } catch (Exception ex) { System.out.println("Se produjo un error inesperado"); } }
public void testWriteDB() throws SQLException { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (Exception ex) { System.err.println("Could not initiate JDBC driver."); ex.printStackTrace(); } try { Connection conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/wittcarl_recurrence_plot_clustering?user=root&password=mysql"); TimeSeriesGenerator tsg = new TimeSeriesGenerator(1, 1000, "lorenz"); double[][] trajectory = tsg.lorenz_standard[0]; DRQA drqa = new DRQA(trajectory, trajectory, 0.05); drqa.computeRQA(2, 2, 2); drqa.writeResultDB( "IN_MEMORY", "lorenz", DRQA.EmbeddingMethod.ORIGINAL_TRAJECTORY.ordinal(), 3, -1, trajectory[0].length, DRQA.LMinMethod.L_MIN_FIX.ordinal(), 2, 0, conn); } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } }
/** * Obtenir une nouvelle connexion a la BD, en fonction des parametres contenus dans un fichier de * configuration. * * @return une nouvelle connexion a la BD * @throws ExceptionConnexion si la connexion a echoue */ public static Connection getConnexion(String login, String mdp) throws ExceptionConnexion { Connection conn = null; try { // lecture des parametres de connexion dans connection.conf Properties p = new Properties(); InputStream is = null; is = new FileInputStream(utils.Constantes.Home + utils.Constantes.Config); p.load(is); String url = p.getProperty("url"); String driver = p.getProperty("driver"); Class.forName(driver); // hopper@UFR, Oracle conn = DriverManager.getConnection(url, login, mdp); conn.setAutoCommit(false); } catch (SQLException e) { System.out.println("Connexion impossible : " + e.getMessage()); // handle any errors System.out.println("SQLException: " + e.getMessage()); System.out.println("SQLState: " + e.getSQLState()); System.out.println("VendorError: " + e.getErrorCode()); } catch (IOException e) { throw new ExceptionConnexion("fichier conf illisible \n" + e.getMessage()); } catch (ClassNotFoundException e) { throw new ExceptionConnexion("problème d'identification du pilote \n" + e.getMessage()); } return conn; }
public boolean execute(String update) { // System.out.println( "Database.execute: "+ update ); Statement stmt = null; ResultSet results = null; try { assureConnected(); stmt = connection.createStatement(); stmt.executeUpdate(update); } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); return false; } finally { if (results != null) { try { results.close(); } catch (SQLException sqlEx) { sqlEx.printStackTrace(); } results = null; } if (stmt != null) { try { stmt.close(); } catch (SQLException sqlEx) { sqlEx.printStackTrace(); } stmt = null; } } return true; }
private void putUpdateStoredBlock(StoredBlock storedBlock, boolean wasUndoable) throws SQLException { try { PreparedStatement s = conn.get() .prepareStatement( "INSERT INTO headers(hash, chainWork, height, header, wasUndoable)" + " VALUES(?, ?, ?, ?, ?)"); // We skip the first 4 bytes because (on prodnet) the minimum target has 4 0-bytes byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 3, hashBytes, 0, 28); s.setBytes(1, hashBytes); s.setBytes(2, storedBlock.getChainWork().toByteArray()); s.setInt(3, storedBlock.getHeight()); s.setBytes(4, storedBlock.getHeader().unsafeRimbitSerialize()); s.setBoolean(5, wasUndoable); s.executeUpdate(); s.close(); } catch (SQLException e) { // It is possible we try to add a duplicate StoredBlock if we upgraded // In that case, we just update the entry to mark it wasUndoable if (!(e.getSQLState().equals(POSTGRES_DUPLICATE_KEY_ERROR_CODE)) || !wasUndoable) throw e; PreparedStatement s = conn.get().prepareStatement("UPDATE headers SET wasUndoable=? WHERE hash=?"); s.setBoolean(1, true); // We skip the first 4 bytes because (on prodnet) the minimum target has 4 0-bytes byte[] hashBytes = new byte[28]; System.arraycopy(storedBlock.getHeader().getHash().getBytes(), 3, hashBytes, 0, 28); s.setBytes(2, hashBytes); s.executeUpdate(); s.close(); } }
private boolean AidedIn(SaoWorker w) { BatSQL bSQL = new BatSQL(); boolean success = false; String id = w.getUserID(); String q = "select * from aidedin where USERID='" + id + "'"; ResultSet rs = bSQL.query(q); try { boolean more = rs.next(); if (more) { success = true; } } //end of try catch (SQLException ex) { System.out.println("!*******SQLException caught*******!"); while (ex != null) { System.out.println ("SQLState: " + ex.getSQLState ()); System.out.println ("Message: " + ex.getMessage ()); System.out.println ("Vendor: " + ex.getErrorCode ()); ex = ex.getNextException (); System.out.println (""); } System.exit(0); } //end catching SQLExceptions catch (java.lang.Exception ex) { System.out.println("!*******Exception caught*******!"); System.exit(0); } //end catching other Exceptions bSQL.disconnect(); return success; } //end of AidedIn?
/** Method declaration Adjust this method for large strings...ie multi megabtypes. */ void execute() { String sCmd = null; if (4096 <= ifHuge.length()) { sCmd = ifHuge; } else { sCmd = txtCommand.getText(); } if (sCmd.startsWith("-->>>TEST<<<--")) { testPerformance(); return; } String g[] = new String[1]; lTime = System.currentTimeMillis(); try { sStatement.execute(sCmd); lTime = System.currentTimeMillis() - lTime; int r = sStatement.getUpdateCount(); if (r == -1) { formatResultSet(sStatement.getResultSet()); } else { g[0] = "update count"; gResult.setHead(g); g[0] = String.valueOf(r); gResult.addRow(g); } addToRecent(txtCommand.getText()); } catch (SQLException e) { lTime = System.currentTimeMillis() - lTime; g[0] = "SQL Error"; gResult.setHead(g); String s = e.getMessage(); s += " / Error Code: " + e.getErrorCode(); s += " / State: " + e.getSQLState(); g[0] = s; gResult.addRow(g); } updateResult(); System.gc(); }
@RequestMapping("/gyms") public ModelAndView gyms( @RequestParam(required = false) String sortBy, @RequestParam(required = false) String mapurl) throws Exception { ModelAndView mav = new ModelAndView("gyms"); try (Connection con = DriverManager.getConnection("jdbc:mysql://localhost/basketball", "root", "mysql")) { String urlString; List<Hallen> gyms = new ArrayList<>(); PreparedStatement stm = con.prepareStatement( "select hallenId, Mannschaft, Hallenname, straße, plz, ort from hallen"); ResultSet rs = stm.executeQuery(); while (rs.next()) { Hallen gym = new Hallen(); gym.setTeam(rs.getString("mannschaft")); gym.setHallenid(rs.getString("hallenId")); gym.setName(rs.getString("Hallenname")); gym.setStreet(rs.getString("straße")); gym.setPlz(rs.getInt("plz")); gym.setCity(rs.getString("ort")); urlString = gym.getStreet() + ", " + gym.getPlz() + " " + gym.getCity() + "&zoom=18"; gym.setUrl(URLEncoder.encode(urlString, "UTF-8")); gyms.add(gym); if (sortBy != null) { switch (sortBy) { case "team": Collections.sort(gyms, (o1, o2) -> o1.getTeam().compareTo(o2.getTeam())); break; case "id": Collections.sort(gyms, (o1, o2) -> o1.getHallenid().compareTo(o2.getHallenid())); break; case "name": Collections.sort(gyms, (o1, o2) -> o1.getName().compareTo(o2.getName())); break; case "city": Collections.sort(gyms, (o1, o2) -> o1.getCity().compareTo(o2.getCity())); break; } } } if (mapurl == null) { mapurl = "cologne&zoom=10"; } mav.addObject("map", mapurl); mav.addObject("sort", sortBy); mav.addObject("gyms", gyms); } catch (SQLException ex) { // handle any errors System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } return mav; }
public static SQLClientInfoException toSQLClientInfoException(Throwable t) { if (t instanceof SQLClientInfoException) return (SQLClientInfoException) t; else if (t.getCause() instanceof SQLClientInfoException) return (SQLClientInfoException) t.getCause(); else if (t instanceof SQLException) { SQLException sqle = (SQLException) t; return new SQLClientInfoException( sqle.getMessage(), sqle.getSQLState(), sqle.getErrorCode(), null, t); } else return new SQLClientInfoException(t.getMessage(), null, t); }
/** * Maakt een nieuw statement op basis van een open connectie. Indien de connectie gesloten is, of * een andere fout optreedt, dan wordt het programma afgesloten. * * @param connection een connectie die reeds geopend moet zijn. * @return een statement-object dat gebruikt kan worden om SQL-statements uit te voeren. */ private Statement maakStatement(Connection connection) { try { statement = connection.createStatement(); } catch (SQLException e) { System.out.println("SQLException: " + e.getMessage()); System.out.println("SQLState = " + e.getSQLState()); System.out.println("Error code = " + e.getErrorCode()); System.exit(1); } return statement; }
public void ramasserObjet() { boolean vide = true; try { ResultSet rset = stmt.executeQuery( "select idObjet from objet where positionX=" + positionX + " and positionY=" + positionY); Hashtable<String, String> tabObj = new Hashtable<String, String>(); while (rset.next()) { vide = false; String idObj = rset.getString("idObjet"); System.out.println(idObj); tabObj.put(idObj, idObj); } rset.close(); if (!vide) { System.out.println("Quel objet voulez vous ramasser ? : "); String obj = IO.lireChaine(); if (tabObj.containsKey(obj)) { proc = conn.prepareCall("{call rammasser(?,?)}"); proc.setInt(1, idTroll); proc.setString(2, obj); proc.executeUpdate(); proc.close(); rset = stmt.executeQuery("select typeObjet from objet where idObjet='" + obj + "'"); rset.first(); String type = rset.getString("typeObjet"); if (type.equals("potion")) { menu.supprimerPopo(obj); } else { menu.supprimerObjet(obj); } rset = stmt.executeQuery("select paRestants from troll where idTroll=" + idTroll); int ancVal = 0; while (rset.next()) { ancVal = rset.getInt("paRestants"); } stmt.executeUpdate( "update troll SET paRestants = " + (ancVal - 1) + " where idTroll=" + idTroll); paRestants = paRestants - 1; } else { System.out.println("Cet objet ne se trouve pas sur votre case !"); } } else { System.out.println("Il n'y a aucun objet sur votre case"); } } catch (SQLException E) { System.err.println("SQLException: " + E.getMessage()); System.err.println("SQLState: " + E.getSQLState()); } }
/** * Maakt een nieuwe connectie met de database. Indien het maken van de connectie faalt, wordt het * programma afgesloten. * * @param databasePath het pad van de database die gebruikt moet worden. * @return een open connectie naar de database. */ private Connection maakConnectie(String databasePath) { try { connection = DriverManager.getConnection(databasePath); } catch (SQLException e) { System.out.println("SQLException: " + e.getMessage()); System.out.println("SQLState = " + e.getSQLState()); System.out.println("Error code = " + e.getErrorCode()); System.out.println("Connectie"); System.exit(1); } return connection; }
private SQLDatabase(String url, String username, String password) throws SQLException { try { DriverManager.registerDriver(new com.mysql.jdbc.Driver()); System.out.println("connection: " + username + "@" + url); connection = DriverManager.getConnection(url, username, password); } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); System.exit(0); } }
public void testSerialize() throws IOException, ClassNotFoundException { SparseDoubleMatrix2D matrix2D = new SparseDoubleMatrix2D( new double[][] { new double[] {1, 2, 3}, new double[] {4, 5, 6}, new double[] {7, 8, 9} }); System.out.println(String.format("matrix2D: %s", matrix2D)); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (Exception ex) { System.err.println("Could not initiate JDBC driver."); ex.printStackTrace(); } try { Connection conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/wittcarl_recurrence_plot_clustering?user=root&password=mysql"); PreparedStatement preps = conn.prepareStatement( "INSERT INTO `wittcarl_recurrence_plot_clustering`.`blob` (`id`, `signature`) VALUES (null, ?);"); preps.setObject(1, matrix2D); preps.execute(); PreparedStatement get = conn.prepareStatement("SELECT id, signature FROM `blob` WHERE id=3"); ResultSet resultSet = get.executeQuery(); resultSet.next(); int id = resultSet.getInt(1); InputStream is = resultSet.getBlob(2).getBinaryStream(); ObjectInputStream oip = new ObjectInputStream(is); Object object = oip.readObject(); String className = object.getClass().getName(); oip.close(); is.close(); resultSet.close(); // de-serialize list a java object from a given objectID SparseDoubleMatrix2D restored = (SparseDoubleMatrix2D) object; System.out.println(String.format("id: %s", id)); System.out.println(String.format("restored: %s", restored)); conn.close(); } catch (SQLException ex) { // handle any errors System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } }
/** Close connection to database. */ public void close() { try { connection.close(); } catch (SQLException ex) { throw new RuntimeException( "SQLException: " + ex.getMessage() + "\nSQLState: " + ex.getSQLState() + "\nVendorError: " + ex.getErrorCode()); } }
/** * Test function. Open connection to database and close it. * * @param db database reference */ public static void test(Database db) { try { db.connection.close(); } catch (SQLException ex) { throw new RuntimeException( "SQLException: " + ex.getMessage() + "\nSQLState: " + ex.getSQLState() + "\nVendorError: " + ex.getErrorCode()); } }
/** * Illustrates creating a database connection using standard JDBC and then using this connection * to create a ConnectionPool and execute a select statement. */ public static void testCreatingOwnConnection() { Connection con = null; try { Class.forName(driverName).newInstance(); con = DriverManager.getConnection(connURL, username, password); } catch (SQLException sqle) { System.out.println(sqle.getMessage() + "\n" + "SQL State: " + sqle.getSQLState()); } catch (Exception e) { System.out.println(e.getMessage()); } SQLExecutor sqlExec = new SQLExecutor(new ConnectionPool(con)); SQLResults res = sqlExec.runQueryCloseCon("SELECT COUNT(*) FROM JDBC_TEST"); System.out.println("Record count=" + res.getInt(0, 0)); }
private SQLDatabase() throws SQLException { try { String database = Settings.getString(Parameter.DATABASE); String user = Settings.getString(Parameter.USER); String password = Settings.getString(Parameter.PASSWORD); DriverManager.registerDriver(new com.mysql.jdbc.Driver()); System.out.println("connection: " + user + "@" + database); connection = DriverManager.getConnection(database, user, password); } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); throw ex; } }
public void assureConnected() throws SQLException { try { Statement stmt = connection.createStatement(); ResultSet results = stmt.executeQuery("select 1"); results.close(); stmt.close(); } catch (SQLException e) { String state = e.getSQLState(); if (state.equals("08S01") || state.equals("08003")) { // try to reconnect String database = Settings.getString(Parameter.DATABASE); String user = Settings.getString(Parameter.USER); String password = Settings.getString(Parameter.PASSWORD); connection = DriverManager.getConnection(database, user, password); } } }
public ResultSet query(String query) { System.out.println("SQLDatabase.query: " + query); Statement stmt = null; ResultSet results = null; try { assureConnected(); stmt = connection.createStatement(); stmt.setFetchSize(5000); results = stmt.executeQuery(query); return results; } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } return null; }
public void tesObjets() { try { ResultSet rset = stmt.executeQuery( "select idObjet from equipement where idTroll=" + idTroll + " and estEquipe=false"); while (rset.next()) { String idObj = rset.getString("idObjet"); System.out.println(idObj); } rset.close(); System.out.println(); } catch (SQLException E) { System.err.println("SQLException: " + E.getMessage()); System.err.println("SQLState: " + E.getSQLState()); } }
private static void shutdown() { // standard checking code when shutting down database. // code from http://db.apache.org/derby/ if (framework.equals("embedded")) { try { // the shutdown=true attribute shuts down Derby DriverManager.getConnection("jdbc:derby:;shutdown=true"); } catch (SQLException se) { if (((se.getErrorCode() == 50000) && ("XJ015".equals(se.getSQLState())))) { System.out.println("Derby shut down normally"); } else { System.err.println("Derby did not shut down normally"); se.printStackTrace(); } } } }
public void utiliserPopo(objet potion) { int val = 0; int ancVal = 0; String carac = null; try { stmt.executeUpdate( "update equipement SET estEquipe = true where idObjet ='" + potion.idObjet() + "' and idTroll=" + idTroll); ResultSet rset = stmt.executeQuery( "select caracteristique from carac where idObjet='" + potion.idObjet() + "'"); while (rset.next()) { carac = rset.getString("caracteristique"); } rset = conn.createStatement() .executeQuery("select valeur from carac where idObjet='" + potion.idObjet() + "'"); while (rset.next()) { val = rset.getInt("valeur"); } rset = stmt.executeQuery("select " + carac + " from troll where idTroll=" + idTroll); while (rset.next()) { ancVal = rset.getInt(carac); } stmt.executeUpdate( "update troll SET " + carac + " = " + (ancVal + val) + "where idTroll=" + idTroll); rset = stmt.executeQuery("select paRestants from troll where idTroll=" + idTroll); while (rset.next()) { ancVal = rset.getInt("paRestants"); } stmt.executeUpdate( "update troll SET paRestants = " + (ancVal - 1) + " where idTroll=" + idTroll); tabPopoEnCours.put(potion.idObjet(), potion); paRestants = paRestants - 1; } catch (SQLException E) { System.err.println("SQLException: " + E.getMessage()); System.err.println("SQLState: " + E.getSQLState()); } }
public void validateTable() throws SQLException { // alter table if columns are missing final Statement alterStatement = dbConnection.createStatement(); // add missing columns to the table int i = 0; for (String n : colNames) { final String testStr = "SELECT '" + n + "' FROM " + TABLE; try { alterStatement.executeQuery(testStr); } catch (SQLException e) { if (e.getSQLState().equals("42X04")) { final String alterStr = "ALTER TABLE " + TABLE + " ADD '" + n + "' " + colTypes[i]; alterStatement.execute(alterStr); } } ++i; } }
public static SQLException toSQLException(String msg, String sqlState, Throwable t) { if (t instanceof SQLException) { if (Debug.DEBUG && Debug.TRACE == Debug.TRACE_MAX && logger.isLoggable(MLevel.FINER)) { SQLException s = (SQLException) t; StringBuffer tmp = new StringBuffer(255); tmp.append("Attempted to convert SQLException to SQLException. Leaving it alone."); tmp.append(" [SQLState: "); tmp.append(s.getSQLState()); tmp.append("; errorCode: "); tmp.append(s.getErrorCode()); tmp.append(']'); if (msg != null) tmp.append(" Ignoring suggested message: '" + msg + "'."); logger.log(MLevel.FINER, tmp.toString(), t); SQLException s2 = s; while ((s2 = s2.getNextException()) != null) logger.log(MLevel.FINER, "Nested SQLException or SQLWarning: ", s2); } return (SQLException) t; } else { if (Debug.DEBUG) { // t.printStackTrace(); if (logger.isLoggable(MLevel.FINE)) logger.log(MLevel.FINE, "Converting Throwable to SQLException...", t); } if (msg == null) msg = "An SQLException was provoked by the following failure: " + t.toString(); if (VersionUtils.isAtLeastJavaVersion14()) { SQLException out = new SQLException(msg); out.initCause(t); return out; } else return new SQLException( msg + System.getProperty("line.separator") + "[Cause: " + ThrowableUtils.extractStackTrace(t) + ']', sqlState); } }
private void connect() throws SQLException { if (connection != null) { try { connection.createStatement().execute("SELECT 1;"); } catch (SQLException sqlException) { if (sqlException.getSQLState().equals("08S01")) { try { connection.close(); } catch (SQLException ignored) { } } } } if (connection == null || connection.isClosed()) { connection = DriverManager.getConnection(connectionUri, username, password); } }
public boolean openConnection() { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); // System.out.println(dbstring+"?"+ "user="******"&password="******"?" + "user="******"&password="******"SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); return false; } catch (Exception ex) { ex.printStackTrace(); return false; } return true; }
public void reinitialiserTroll() { String idObjet; try { ResultSet rset = stmt.executeQuery("select idObjet from equipement where idTroll=" + idTroll); while (rset.next()) { idObjet = rset.getString("idObjet"); this.desequiperObjet(idObjet); // int res = stmt.executeUpdate("delete from equipement where idObjet=idObjet"); } } catch (SQLException E) { System.err.println("SQLException: " + E.getMessage()); System.err.println("SQLState: " + E.getSQLState()); } Enumeration enumPopo = tabPopoEnCours.elements(); while (enumPopo.hasMoreElements()) { objet popo = (objet) enumPopo.nextElement(); popo.supprimerTourPopo(); this.verifTourPopo(); } }
/** * Finds out if an aide is covering for another aide * and makes an entry to the AIDELOG to note that * coverage has ended. * * @param The SaoWorker who might be covering */ public void Covering(final SaoWorker w) { BatSQL bSQL = new BatSQL(); String qc = "select * from AIDEDIN where USERID='" + w.getUserID() + "'"; ResultSet rs = bSQL.query(qc); String cid = new String(); try { rs.next(); cid = rs.getString(2); } catch (SQLException ex) { System.out.println("!*******SQLException caught*******!"); System.out.println("Covering"); while (ex != null) { System.out.println ("SQLState: " + ex.getSQLState ()); System.out.println ("Message: " + ex.getMessage ()); System.out.println ("Vendor: " + ex.getErrorCode ()); ex = ex.getNextException (); System.out.println (""); } System.exit(0); } //end catching SQLExceptions catch (java.lang.Exception ex) { System.out.println("!*******Exception caught*******!"); System.out.println("Covering"); System.exit(0); } //end catching other Exceptions if (!cid.equals("No")) //then covering { String uc = "insert into AIDELOG values ('C', '" + cid + "', \"" + bd.getDate() + "\", " + bd.getStringHours() + bd.getStringMinutes() + ", 'O')"; bSQL.update(uc); } bSQL.disconnect(); } //end of Covering