// // Examine BLOBs and CLOBs. // private void vetLargeObjects( Connection conn, HashSet<String> unsupportedList, HashSet<String> notUnderstoodList) throws Exception { Statement stmt = conn.createStatement(); stmt.execute("CREATE TABLE t (id INT PRIMARY KEY, " + "b BLOB(10), c CLOB(10))"); stmt.execute( "INSERT INTO t (id, b, c) VALUES (1, " + "CAST (" + TestUtil.stringToHexLiteral("101010001101") + "AS BLOB(10)), CAST ('hello' AS CLOB(10)))"); ResultSet rs = stmt.executeQuery("SELECT id, b, c FROM t"); rs.next(); Blob blob = rs.getBlob(2); Clob clob = rs.getClob(3); vetObject(blob, unsupportedList, notUnderstoodList); vetObject(clob, unsupportedList, notUnderstoodList); stmt.close(); conn.rollback(); }
/** * Try to update the row with the given error. Flag a failure if a timeout occurs when not * expected, and vice versa. * * @param id The id of the row to be updated * @param timeoutExpected true if it is expected that the update times out * @throws java.sql.SQLException */ private void executeParallelUpdate(int id, boolean timeoutExpected) throws SQLException { Connection conn2 = openDefaultConnection(); Statement stmt2 = conn2.createStatement(); try { stmt2.executeUpdate( "update BLOBCLOB set BLOBDATA = " + "cast(X'FFFFFF' as blob) where ID=" + id); stmt2.close(); conn2.commit(); conn2.close(); if (timeoutExpected) { fail("FAIL - should have gotten lock timeout"); } } catch (SQLException se) { stmt2.close(); conn2.rollback(); conn2.close(); if (timeoutExpected) { assertSQLState(LOCK_TIMEOUT, se); } else { throw se; } } }