import java.sql.SQLException; import java.sql.Statement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.util.*; public class Bug14180 extends testsuite.BaseTestCase { private static final String insertQuery = "insert into table (foo) values (?foo)"; public Bug14180(String name) { super(name); } public void setUp() throws Exception { dbUrl = "jdbc:mysql://localhost:3306/test?user=root"; super.setUp(); } public void testPound14180() throws SQLException { System.out.println("START"); byte[] largeByteArr7Megabytes = new byte[7340032]; Statement stmt = conn.createStatement(); stmt.executeQuery("SET SESSION max_allowed_packet=16777216"); ResultSet rs = stmt.executeQuery("SHOW variables LIKE 'max_allowed_packet'"); rs.next(); System.out.println (rs.getString(1) + ":" + rs.getInt(2)); String sql = "INSERT INTO some_table (NAME, DATA) VALUES('aName', ?)"; PreparedStatement ps = conn.prepareStatement(sql); ps.setBytes(1, largeByteArr7Megabytes); ps.execute(); System.out.println("END"); } public static void main(String args[]) throws Exception { junit.textui.TestRunner.run(Bug14180.class); } }