/** * */ package testsuite.simple; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; import com.mysql.jdbc.SQLError; import testsuite.BaseTestCase; /** * @author Tonci * */ public class TestBug44324 extends BaseTestCase { /** * @param name */ public TestBug44324(String name) { super(name); // TODO Auto-generated constructor stub } public void testBug44324() throws Exception { try { System.out.println("java.vm.version : " + System.getProperty("java.vm.version")); System.out.println("java.vm.vendor : " + System.getProperty("java.vm.vendor")); System.out.println("java.runtime.version : " + System.getProperty("java.runtime.version")); System.out.println("os : " + System.getProperty("os.name") + ", " + System.getProperty("os.version") + ", " + System.getProperty("os.arch")); System.out.println("sun.management.compiler : " + System.getProperty("sun.management.compiler")); System.out.println("-------------------------------------------------"); createTable("`bug44324`", "(Id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, SomeVChar VARCHAR(10)) ENGINE=MyISAM;"); Properties props = new Properties(); props.put("jdbcCompliantTruncation", "true"); Connection conn1 = null; conn1 = getConnectionWithProps(props); Statement stm = conn1.createStatement(); try { stm.executeUpdate("INSERT INTO bug44324 values (null, 'Some text much longer than 10 characters')"); } catch (SQLException sqlEx) { System.out.println("State: " + sqlEx.getSQLState()); System.out.println("ErrCode: " + sqlEx.getErrorCode()); } conn1.close(); props.put("jdbcCompliantTruncation", "false"); conn1 = getConnectionWithProps(props); stm = conn1.createStatement(); stm.executeUpdate("INSERT INTO bug44324 values (null, 'Some text much longer than 10 characters, second try')"); System.out.println("Done"); } finally { closeMemberJDBCResources(); } } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub junit.textui.TestRunner.run(TestBug44324.class); } }