package testsuite.regression; import java.sql.*; import java.util.*; public class Bug67225 extends testsuite.BaseTestCase { public Bug67225(String s) { super(s); } public void testBug67225() throws Exception { Properties props = new Properties(); props.setProperty("useServerPrepStmts", "true"); Connection conn = getConnectionWithProps(props); // first byte <0x7f, second byte >0x7f byte[] data = new byte[] {0x50, (byte)0x80}; System.err.println(" to server => " + Arrays.toString(data)); // truncation doesn't occur //PreparedStatement ps = conn.prepareStatement("select ? , ?"); // truncation doesn't occur //PreparedStatement ps = conn.prepareStatement("select cast(? as binary(2)) union select (?)"); // truncatation DOES occur PreparedStatement ps = conn.prepareStatement("select ? union select ?"); ps.setBytes(1, data); ps.setBytes(2, data); ResultSet rs = ps.executeQuery(); while (rs.next()) System.err.println(" from server => " + Arrays.toString(rs.getBytes(1))); ps.close(); } }