Java Code Examples for java.sql.CallableStatement#setBytes()
The following examples show how to use
java.sql.CallableStatement#setBytes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlobStoredProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** * Tests the SYSIBM.BLOBGETPOSITIONFROMBYTES stored procedure. * * @throws SQLException. */ public void testBlobGetPositionFromBytesSP() throws Exception { CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBGETPOSITIONFROMBYTES(?,?,?)"); cs.registerOutParameter(1, java.sql.Types.BIGINT); cs.setInt(2, 1); //find the position of the bytes corresponding to //the String simple in the test string. cs.setBytes(3, (new String("simple")).getBytes("US-ASCII")); cs.setLong(4, 1L); cs.executeUpdate(); //check to see that the returned position and the expected position //of the substring simple in the string are matching. assertEquals("Error SYSIBM.BLOBGETPOSITIONFROMBYTES returns " + "the wrong value for the position of the Blob", 8, cs.getLong(1)); cs.close(); }
Example 2
Source File: BlobStoredProcedureTest.java From spliceengine with GNU Affero General Public License v3.0 | 6 votes |
/** * Tests the SYSIBM.BLOBGETPOSITIONFROMBYTES stored procedure. * * @throws SQLException. */ public void testBlobGetPositionFromBytesSP() throws Exception { CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBGETPOSITIONFROMBYTES(?,?,?)"); cs.registerOutParameter(1, java.sql.Types.BIGINT); cs.setInt(2, 1); //find the position of the bytes corresponding to //the String simple in the test string. cs.setBytes(3, (new String("simple")).getBytes("US-ASCII")); cs.setLong(4, 1L); cs.executeUpdate(); //check to see that the returned position and the expected position //of the substring simple in the string are matching. assertEquals("Error SYSIBM.BLOBGETPOSITIONFROMBYTES returns " + "the wrong value for the position of the Blob", 8, cs.getLong(1)); cs.close(); }
Example 3
Source File: Tds9Test.java From jTDS with GNU Lesser General Public License v2.1 | 6 votes |
/** * SQL 2005 allows varbinary(max) as the output parameter of a stored * procedure. Test this functionality now. */ public void testVarbinaryMaxOutput() throws Exception { if( supportsTDS9() ) { Statement stmt = con.createStatement(); stmt.execute( "CREATE PROC #sp_test @in varbinary(max), @out varbinary(max) output as set @out = @in" ); StringBuffer buf = new StringBuffer( 5000 ); buf.append( '<' ); for( int i = 0; i < 8000; i++ ) { buf.append( 'X' ); } buf.append( '>' ); CallableStatement cstmt = con.prepareCall( "{call #sp_test(?,?)}" ); cstmt.setBytes( 1, buf.toString().getBytes() ); cstmt.registerOutParameter( 2, Types.LONGVARBINARY ); cstmt.execute(); assertTrue( buf.toString().equals( new String( cstmt.getBytes( 2 ) ) ) ); cstmt.close(); stmt.close(); } }
Example 4
Source File: BaseTestBlob.java From jaybird with GNU Lesser General Public License v2.1 | 6 votes |
/** * Populates a (segmented) blob using the FILL_BINARY_BLOB stored procedure * * @param id ID of the record to be created in blob_table * @param baseContent Base content * @param requiredSize Required size * @throws SQLException */ protected void populateBlob(int id, byte[] baseContent, int requiredSize) throws SQLException { Connection con = getConnectionViaDriverManager(); CallableStatement cstmt = null; try { cstmt = con.prepareCall(EXECUTE_FILL_BINARY_BLOB); cstmt.setInt(1, id); cstmt.setBytes(2, baseContent); cstmt.setInt(3, requiredSize); cstmt.execute(); } finally { closeQuietly(cstmt); closeQuietly(con); } }
Example 5
Source File: CallableTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** * Calls a SQL procedure that takes non-numeric IN and OUT parameters. * @throws SQLException */ public void testNonNumericTypesInAndOutProc() throws SQLException { CallableStatement cs = prepareCall ("call NON_NUMERIC_TYPES_IN_AND_OUT_PROC(?,?,?,?,?,?,?,?)"); cs.setDate(1, Date.valueOf("2002-05-12")); cs.setTime(2, Time.valueOf("10:05:02")); cs.setTimestamp(3, Timestamp.valueOf("2002-05-12 10:05:02.000000000")); byte[] ba = new byte[2]; ba[0] = 1; ba[1] = 2; cs.setBytes(4, ba); cs.registerOutParameter (5, java.sql.Types.DATE); cs.registerOutParameter (6, java.sql.Types.TIME); cs.registerOutParameter (7, java.sql.Types.TIMESTAMP); cs.registerOutParameter (8, java.sql.Types.VARBINARY); cs.execute(); assertEquals("OUT date", Date.valueOf("2002-05-12"), cs.getDate(5)); assertEquals("OUT time" , Time.valueOf("10:05:02"), cs.getTime(6)); assertEquals("OUT timestamp" , Timestamp.valueOf("2002-05-12 10:05:02.000000000"), cs.getTimestamp(7)); assertTrue(Arrays.equals(ba, cs.getBytes(8))); }
Example 6
Source File: BlobStoredProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
/** * Tests the SYSIBM.BLOBGETPOSITIONFROMBYTES stored procedure. * * @throws SQLException. */ public void testBlobGetPositionFromBytesSP() throws Exception { CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBGETPOSITIONFROMBYTES(?,?,?)"); cs.registerOutParameter(1, java.sql.Types.BIGINT); cs.setInt(2, 1); //find the position of the bytes corresponding to //the String simple in the test string. cs.setBytes(3, (new String("simple")).getBytes("US-ASCII")); cs.setLong(4, 1L); cs.executeUpdate(); //check to see that the returned position and the expected position //of the substring simple in the string are matching. assertEquals("Error SYSIBM.BLOBGETPOSITIONFROMBYTES returns " + "the wrong value for the position of the Blob", 8, cs.getLong(1)); cs.close(); }
Example 7
Source File: BlobStoredProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * Setup the test. * @throws UnsupportedEncodingException * @throws a SQLException. */ protected void setUp() throws SQLException, UnsupportedEncodingException { //Byte array obatined from the string byte [] strBytes = testStr.getBytes("US-ASCII"); //initialize the locator to a default value. int locator = -1; //set auto commit to false for the connection getConnection().setAutoCommit(false); //call the stored procedure to return the created locator. CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBCREATELOCATOR()"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.executeUpdate(); locator = cs.getInt(1); cs.close(); //use this new locator to test the SETBYTES function //by inserting the new bytes and testing whether it has //been inserted properly. //Insert the new substring. cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)"); cs.setInt(1, locator); cs.setLong(2, 1L); cs.setInt(3, (int)testStrLength); cs.setBytes(4, strBytes); cs.execute(); cs.close(); }
Example 8
Source File: CallableTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * Calls a SQL procedure that takes non-numeric IN and OUT parameters. * @throws SQLException */ public void testNonNumericTypesInAndOutProc() throws SQLException { CallableStatement cs = prepareCall ("call NON_NUMERIC_TYPES_IN_AND_OUT_PROC(?,?,?,?,?,?,?,?)"); cs.setDate(1, Date.valueOf("2002-05-12")); cs.setTime(2, Time.valueOf("10:05:02")); cs.setTimestamp(3, Timestamp.valueOf("2002-05-12 10:05:02.000000000")); byte[] ba = new byte[2]; ba[0] = 1; ba[1] = 2; cs.setBytes(4, ba); cs.registerOutParameter (5, java.sql.Types.DATE); cs.registerOutParameter (6, java.sql.Types.TIME); cs.registerOutParameter (7, java.sql.Types.TIMESTAMP); cs.registerOutParameter (8, java.sql.Types.VARBINARY); cs.execute(); assertEquals("OUT date", Date.valueOf("2002-05-12"), cs.getDate(5)); assertEquals("OUT time" , Time.valueOf("10:05:02"), cs.getTime(6)); assertEquals("OUT timestamp" , Timestamp.valueOf("2002-05-12 10:05:02.000000000"), cs.getTimestamp(7)); assertTrue(Arrays.equals(ba, cs.getBytes(8))); }
Example 9
Source File: SWCallableStatementTest.java From skywalking with Apache License 2.0 | 5 votes |
@Test(expected = SQLException.class) public void testMultiHostWithException() throws SQLException { when(mysqlCallableStatement.executeQuery()).thenThrow(new SQLException()); try { CallableStatement preparedStatement = multiHostConnection.prepareCall("SELECT * FROM test WHERE a = ? OR b = ? OR c=? OR d = ? OR e=?"); preparedStatement.setBigDecimal(1, new BigDecimal(10000)); preparedStatement.setBlob(2, inputStream); preparedStatement.setBlob(3, inputStream, 1000000L); preparedStatement.setByte(3, (byte) 1); preparedStatement.setBytes(4, bytesParam); preparedStatement.setLong(5, 100L); ResultSet resultSet = preparedStatement.executeQuery(); preparedStatement.close(); } finally { verify(mysqlCallableStatement).executeQuery(); verify(mysqlCallableStatement, times(0)).close(); verify(mysqlCallableStatement).setBigDecimal(anyInt(), any(BigDecimal.class)); verify(mysqlCallableStatement).setBlob(anyInt(), any(InputStream.class)); verify(mysqlCallableStatement).setBlob(anyInt(), any(InputStream.class), anyLong()); verify(mysqlCallableStatement).setByte(anyInt(), anyByte()); assertThat(segmentStorage.getTraceSegments().size(), is(1)); TraceSegment traceSegment = segmentStorage.getTraceSegments().get(0); List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment); assertThat(spans.size(), is(1)); assertDBSpan(spans.get(0), "Mysql/JDBI/CallableStatement/executeQuery", "SELECT * FROM test WHERE a = ? OR b = ? OR c=? OR d = ? OR e=?"); List<LogDataEntity> logs = SpanHelper.getLogs(spans.get(0)); Assert.assertThat(logs.size(), is(1)); assertDBSpanLog(logs.get(0)); } }
Example 10
Source File: BlobStoredProcedureTest.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
/** * Setup the test. * @throws UnsupportedEncodingException * @throws a SQLException. */ protected void setUp() throws SQLException, UnsupportedEncodingException { //Byte array obatined from the string byte [] strBytes = testStr.getBytes("US-ASCII"); //initialize the locator to a default value. int locator = -1; //set auto commit to false for the connection getConnection().setAutoCommit(false); //call the stored procedure to return the created locator. CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBCREATELOCATOR()"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.executeUpdate(); locator = cs.getInt(1); cs.close(); //use this new locator to test the SETBYTES function //by inserting the new bytes and testing whether it has //been inserted properly. //Insert the new substring. cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)"); cs.setInt(1, locator); cs.setLong(2, 1L); cs.setInt(3, (int)testStrLength); cs.setBytes(4, strBytes); cs.execute(); cs.close(); }
Example 11
Source File: BlobStoredProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
/** * Setup the test. * @throws UnsupportedEncodingException * @throws a SQLException. */ protected void setUp() throws SQLException, UnsupportedEncodingException { //Byte array obatined from the string byte [] strBytes = testStr.getBytes("US-ASCII"); //initialize the locator to a default value. int locator = -1; //set auto commit to false for the connection getConnection().setAutoCommit(false); //call the stored procedure to return the created locator. CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBCREATELOCATOR()"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.executeUpdate(); locator = cs.getInt(1); cs.close(); //use this new locator to test the SETBYTES function //by inserting the new bytes and testing whether it has //been inserted properly. //Insert the new substring. cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)"); cs.setInt(1, locator); cs.setLong(2, 1L); cs.setInt(3, (int)testStrLength); cs.setBytes(4, strBytes); cs.execute(); cs.close(); }
Example 12
Source File: CallableTest.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
/** * Calls a SQL procedure that takes non-numeric IN and OUT parameters. * @throws SQLException */ public void testNonNumericTypesInAndOutProc() throws SQLException { CallableStatement cs = prepareCall ("call NON_NUMERIC_TYPES_IN_AND_OUT_PROC(?,?,?,?,?,?,?,?)"); cs.setDate(1, Date.valueOf("2002-05-12")); cs.setTime(2, Time.valueOf("10:05:02")); cs.setTimestamp(3, Timestamp.valueOf("2002-05-12 10:05:02.000000000")); byte[] ba = new byte[2]; ba[0] = 1; ba[1] = 2; cs.setBytes(4, ba); cs.registerOutParameter (5, java.sql.Types.DATE); cs.registerOutParameter (6, java.sql.Types.TIME); cs.registerOutParameter (7, java.sql.Types.TIMESTAMP); cs.registerOutParameter (8, java.sql.Types.VARBINARY); cs.execute(); assertEquals("OUT date", Date.valueOf("2002-05-12"), cs.getDate(5)); assertEquals("OUT time" , Time.valueOf("10:05:02"), cs.getTime(6)); assertEquals("OUT timestamp" , Timestamp.valueOf("2002-05-12 10:05:02.000000000"), cs.getTimestamp(7)); assertTrue(Arrays.equals(ba, cs.getBytes(8))); }
Example 13
Source File: BlobStoredProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Tests the stored procedure SYSIBM.BLOBSETBYTES * @throws UnsupportedEncodingException * * @throws SQLException. */ public void testBlobSetBytes() throws SQLException, UnsupportedEncodingException { String newString = "123456789012345"; byte [] newBytes = newString.getBytes("US-ASCII"); //initialize the locator to a default value. int locator = -1; //call the stored procedure to return the created locator. CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBCREATELOCATOR()"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.executeUpdate(); locator = cs.getInt(1); cs.close(); //use this new locator to test the SETBYTES function //by inserting the new bytes and testing whether it has //been inserted properly. //Insert the new substring. cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)"); cs.setInt(1, locator); cs.setLong(2, 1L); cs.setInt(3, newString.length()); cs.setBytes(4, newBytes); cs.execute(); cs.close(); //check the new locator to see if the value has been inserted correctly. cs = prepareCall("? = CALL " + "SYSIBM.BLOBGETBYTES(?,?,?)"); cs.registerOutParameter(1, java.sql.Types.VARBINARY); cs.setInt(2, locator); cs.setLong(3, 1); cs.setInt(4, newString.length()); cs.executeUpdate(); byte [] retVal = cs.getBytes(1); //compare the new bytes and the bytes returned by the stored //procedure to see of they are the same. for (int i=0;i<newString.length();i++){ assertEquals ("The Stored procedure SYSIBM.BLOBGETBYTES " + "returns the wrong bytes" , newBytes[i], retVal[i]); } cs.close(); }
Example 14
Source File: BlobStoredProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Tests the SYSIBM.BLOBGETPOSITIONFROMLOCATOR stored procedure. * @throws UnsupportedEncodingException * * @throws SQLException. */ public void testBlobGetPositionFromLocatorSP() throws SQLException, UnsupportedEncodingException { String newString = "simple"; byte [] newBytes = newString.getBytes("US-ASCII"); //initialize the locator to a default value. int locator = -1; //call the stored procedure to return the created locator. CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBCREATELOCATOR()"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.executeUpdate(); locator = cs.getInt(1); cs.close(); //use this new locator to test the SETBYTES function //by inserting the new bytes and testing whether it has //been inserted properly. //Insert the new substring. cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)"); cs.setInt(1, locator); cs.setLong(2, 1L); cs.setInt(3, newString.length()); cs.setBytes(4, newBytes); cs.execute(); cs.close(); cs = prepareCall ("? = CALL SYSIBM.BLOBGETPOSITIONFROMLOCATOR(?,?,?)"); cs.registerOutParameter(1, java.sql.Types.BIGINT); cs.setInt(2, 1); //find the position of the bytes corresponding to //the String simple in the test string. cs.setInt(3, locator); cs.setLong(4, 1L); cs.executeUpdate(); //check to see that the returned position and the expected position //of the substring simple in the string are matching. assertEquals("Error SYSIBM.BLOBGETPOSITIONFROMLOCATOR returns " + "the wrong value for the position of the Blob", 8, cs.getLong(1)); cs.close(); }
Example 15
Source File: BlobStoredProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Tests the SYSIBM.BLOBGETPOSITIONFROMLOCATOR stored procedure. * @throws UnsupportedEncodingException * * @throws SQLException. */ public void testBlobGetPositionFromLocatorSP() throws SQLException, UnsupportedEncodingException { String newString = "simple"; byte [] newBytes = newString.getBytes("US-ASCII"); //initialize the locator to a default value. int locator = -1; //call the stored procedure to return the created locator. CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBCREATELOCATOR()"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.executeUpdate(); locator = cs.getInt(1); cs.close(); //use this new locator to test the SETBYTES function //by inserting the new bytes and testing whether it has //been inserted properly. //Insert the new substring. cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)"); cs.setInt(1, locator); cs.setLong(2, 1L); cs.setInt(3, newString.length()); cs.setBytes(4, newBytes); cs.execute(); cs.close(); cs = prepareCall ("? = CALL SYSIBM.BLOBGETPOSITIONFROMLOCATOR(?,?,?)"); cs.registerOutParameter(1, java.sql.Types.BIGINT); cs.setInt(2, 1); //find the position of the bytes corresponding to //the String simple in the test string. cs.setInt(3, locator); cs.setLong(4, 1L); cs.executeUpdate(); //check to see that the returned position and the expected position //of the substring simple in the string are matching. assertEquals("Error SYSIBM.BLOBGETPOSITIONFROMLOCATOR returns " + "the wrong value for the position of the Blob", 8, cs.getLong(1)); cs.close(); }
Example 16
Source File: BlobStoredProcedureTest.java From gemfirexd-oss with Apache License 2.0 | 4 votes |
/** * Tests the stored procedure SYSIBM.BLOBSETBYTES * @throws UnsupportedEncodingException * * @throws SQLException. */ public void testBlobSetBytes() throws SQLException, UnsupportedEncodingException { String newString = "123456789012345"; byte [] newBytes = newString.getBytes("US-ASCII"); //initialize the locator to a default value. int locator = -1; //call the stored procedure to return the created locator. CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBCREATELOCATOR()"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.executeUpdate(); locator = cs.getInt(1); cs.close(); //use this new locator to test the SETBYTES function //by inserting the new bytes and testing whether it has //been inserted properly. //Insert the new substring. cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)"); cs.setInt(1, locator); cs.setLong(2, 1L); cs.setInt(3, newString.length()); cs.setBytes(4, newBytes); cs.execute(); cs.close(); //check the new locator to see if the value has been inserted correctly. cs = prepareCall("? = CALL " + "SYSIBM.BLOBGETBYTES(?,?,?)"); cs.registerOutParameter(1, java.sql.Types.VARBINARY); cs.setInt(2, locator); cs.setLong(3, 1); cs.setInt(4, newString.length()); cs.executeUpdate(); byte [] retVal = cs.getBytes(1); //compare the new bytes and the bytes returned by the stored //procedure to see of they are the same. for (int i=0;i<newString.length();i++){ assertEquals ("The Stored procedure SYSIBM.BLOBGETBYTES " + "returns the wrong bytes" , newBytes[i], retVal[i]); } cs.close(); }
Example 17
Source File: BlobStoredProcedureTest.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
/** * Tests the stored procedure SYSIBM.BLOBSETBYTES * @throws UnsupportedEncodingException * * @throws SQLException. */ public void testBlobSetBytes() throws SQLException, UnsupportedEncodingException { String newString = "123456789012345"; byte [] newBytes = newString.getBytes("US-ASCII"); //initialize the locator to a default value. int locator = -1; //call the stored procedure to return the created locator. CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBCREATELOCATOR()"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.executeUpdate(); locator = cs.getInt(1); cs.close(); //use this new locator to test the SETBYTES function //by inserting the new bytes and testing whether it has //been inserted properly. //Insert the new substring. cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)"); cs.setInt(1, locator); cs.setLong(2, 1L); cs.setInt(3, newString.length()); cs.setBytes(4, newBytes); cs.execute(); cs.close(); //check the new locator to see if the value has been inserted correctly. cs = prepareCall("? = CALL " + "SYSIBM.BLOBGETBYTES(?,?,?)"); cs.registerOutParameter(1, java.sql.Types.VARBINARY); cs.setInt(2, locator); cs.setLong(3, 1); cs.setInt(4, newString.length()); cs.executeUpdate(); byte [] retVal = cs.getBytes(1); //compare the new bytes and the bytes returned by the stored //procedure to see of they are the same. for (int i=0;i<newString.length();i++){ assertEquals ("The Stored procedure SYSIBM.BLOBGETBYTES " + "returns the wrong bytes" , newBytes[i], retVal[i]); } cs.close(); }
Example 18
Source File: BlobStoredProcedureTest.java From spliceengine with GNU Affero General Public License v3.0 | 4 votes |
/** * Tests the SYSIBM.BLOBGETPOSITIONFROMLOCATOR stored procedure. * @throws UnsupportedEncodingException * * @throws SQLException. */ public void testBlobGetPositionFromLocatorSP() throws SQLException, UnsupportedEncodingException { String newString = "simple"; byte [] newBytes = newString.getBytes("US-ASCII"); //initialize the locator to a default value. int locator = -1; //call the stored procedure to return the created locator. CallableStatement cs = prepareCall ("? = CALL SYSIBM.BLOBCREATELOCATOR()"); cs.registerOutParameter(1, java.sql.Types.INTEGER); cs.executeUpdate(); locator = cs.getInt(1); cs.close(); //use this new locator to test the SETBYTES function //by inserting the new bytes and testing whether it has //been inserted properly. //Insert the new substring. cs = prepareCall("CALL SYSIBM.BLOBSETBYTES(?,?,?,?)"); cs.setInt(1, locator); cs.setLong(2, 1L); cs.setInt(3, newString.length()); cs.setBytes(4, newBytes); cs.execute(); cs.close(); cs = prepareCall ("? = CALL SYSIBM.BLOBGETPOSITIONFROMLOCATOR(?,?,?)"); cs.registerOutParameter(1, java.sql.Types.BIGINT); cs.setInt(2, 1); //find the position of the bytes corresponding to //the String simple in the test string. cs.setInt(3, locator); cs.setLong(4, 1L); cs.executeUpdate(); //check to see that the returned position and the expected position //of the substring simple in the string are matching. assertEquals("Error SYSIBM.BLOBGETPOSITIONFROMLOCATOR returns " + "the wrong value for the position of the Blob", 8, cs.getLong(1)); cs.close(); }