/** * */ package testsuite.simple; import java.sql.CallableStatement; import java.sql.Connection; import java.util.Properties; import testsuite.BaseTestCase; public class TestBug43576 extends BaseTestCase { public TestBug43576(String name) { super(name); // TODO Auto-generated constructor stub } public void testBug43576() 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("-------------------------------------------------"); Properties props = new Properties(); props.put("jdbcCompliantTruncation", "true"); props.put("useInformationSchema","true"); Connection conn1 = null; try { conn1 = getConnectionWithProps(props); this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS bug43576_1"); this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS bug43576_2"); this.stmt.executeUpdate( "CREATE PROCEDURE bug43576_1(OUT nfact VARCHAR(100), IN ccuenta VARCHAR(100)," + "\nOUT ffact VARCHAR(100)," + "\nOUT fdoc VARCHAR(100))" + "\nBEGIN" + "\nSET nfact = 'ncfact string';" + "\nSET ffact = 'ffact string';" + "\nSET fdoc = 'fdoc string';" + "\nEND"); this.stmt.executeUpdate( "CREATE PROCEDURE bug43576_2(IN ccuent1 VARCHAR(100), IN ccuent2 VARCHAR(100)," + "\nOUT nfact VARCHAR(100)," + "\nOUT ffact VARCHAR(100)," + "\nOUT fdoc VARCHAR(100))" + "\nBEGIN" + "\nSET nfact = 'ncfact string';" + "\nSET ffact = 'ffact string';" + "\nSET fdoc = 'fdoc string';" + "\nEND"); CallableStatement callSt = conn1.prepareCall("{ call bug43576_1(?, ?, ?, ?) }"); callSt.setString(2, "xxx"); callSt.registerOutParameter(1, java.sql.Types.VARCHAR); callSt.registerOutParameter(3, java.sql.Types.VARCHAR); callSt.registerOutParameter(4, java.sql.Types.VARCHAR); callSt.execute(); assertEquals("ncfact string", callSt.getString(1)); assertEquals("ffact string", callSt.getString(3)); assertEquals("fdoc string", callSt.getString(4)); CallableStatement callSt2 = conn1.prepareCall("{ call bug43576_2(?, ?, ?, ?, ?) }"); callSt2.setString(1, "xxx"); callSt2.setString(2, "yyy"); callSt2.registerOutParameter(3, java.sql.Types.VARCHAR); callSt2.registerOutParameter(4, java.sql.Types.VARCHAR); callSt2.registerOutParameter(5, java.sql.Types.VARCHAR); callSt2.execute(); assertEquals("ncfact string", callSt2.getString(3)); assertEquals("ffact string", callSt2.getString(4)); assertEquals("fdoc string", callSt2.getString(5)); CallableStatement callSt3 = conn1.prepareCall("{ call bug43576_2(?, 'yyy', ?, ?, ?) }"); callSt3.setString(1, "xxx"); //callSt3.setString(2, "yyy"); callSt3.registerOutParameter(2, java.sql.Types.VARCHAR); callSt3.registerOutParameter(3, java.sql.Types.VARCHAR); callSt3.registerOutParameter(4, java.sql.Types.VARCHAR); callSt3.execute(); assertEquals("ncfact string", callSt3.getString(2)); assertEquals("ffact string", callSt3.getString(3)); assertEquals("fdoc string", callSt3.getString(4)); }finally { if (conn1 != null) { conn1.close(); } } } finally { closeMemberJDBCResources(); } } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub junit.textui.TestRunner.run(TestBug43576.class); } }