@@ -591,89 +591,90 @@ public void testCallableStatementSetByAnnotatedArgs() throws SQLException {
591591 }
592592 }
593593
594- @ Test
595- @ Tag (Constants .reqExternalSetup )
596- @ Tag (Constants .xAzureSQLDB )
597- @ Tag (Constants .xAzureSQLDW )
598- @ Tag (Constants .xAzureSQLMI )
599- public void testFourPartSyntaxCallEscapeSyntax () throws SQLException {
600- String table = AbstractSQLGenerator .escapeIdentifier (RandomUtil .getIdentifier ("serverList" ));
601- try {
602-
603- try (Statement stmt = connection .createStatement ()) {
604- TestUtils .dropTableIfExists (table , stmt );
605- stmt .execute ("CREATE TABLE " + table
606- + " (serverName varchar(100),network varchar(100),serverStatus varchar(4000), id int, collation varchar(100), connectTimeout int, queryTimeout int)" );
607- stmt .execute ("INSERT " + table + " EXEC sp_helpserver" );
608-
609- ResultSet rs = stmt
610- .executeQuery ("SELECT COUNT(*) FROM " + table + " WHERE serverName = N'" + linkedServer + "'" );
611- rs .next ();
612-
613- if (rs .getInt (1 ) == 1 ) {
614- stmt .execute ("EXEC sp_dropserver @server='" + linkedServer + "';" );
615- }
616-
617- stmt .execute ("EXEC sp_addlinkedserver @server='" + linkedServer + "';" );
618- stmt .execute ("EXEC sp_addlinkedsrvlogin @rmtsrvname=N'" + linkedServer + "', @useself=false"
619- + ", @rmtuser=N'" + linkedServerUser + "', @rmtpassword=N'" + linkedServerPassword + "'" );
620- stmt .execute ("EXEC sp_serveroption '" + linkedServer + "', 'rpc', true;" );
621- stmt .execute ("EXEC sp_serveroption '" + linkedServer + "', 'rpc out', true;" );
622- }
623-
624- SQLServerDataSource ds = new SQLServerDataSource ();
625- ds .setServerName (linkedServer );
626- ds .setUser (linkedServerUser );
627- ds .setPassword (linkedServerPassword );
628- ds .setEncrypt (false );
629- ds .setTrustServerCertificate (true );
630-
631- try (Connection linkedServerConnection = ds .getConnection ();
632- Statement stmt = linkedServerConnection .createStatement ()) {
633- stmt .execute (
634- "create or alter procedure dbo.TestAdd(@Num1 int, @Num2 int, @Result int output) as begin set @Result = @Num1 + @Num2; end;" );
635-
636- stmt .execute ("create or alter procedure dbo.TestReturn(@Num1 int) as select @Num1 return @Num1*3 " );
637- }
638-
639- try (CallableStatement cstmt = connection
640- .prepareCall ("{call [" + linkedServer + "].master.dbo.TestAdd(?,?,?)}" )) {
641- int sum = 11 ;
642- int param0 = 1 ;
643- int param1 = 10 ;
644- cstmt .setInt (1 , param0 );
645- cstmt .setInt (2 , param1 );
646- cstmt .registerOutParameter (3 , Types .INTEGER );
647- cstmt .execute ();
648- assertEquals (sum , cstmt .getInt (3 ));
649- }
650-
651- try (CallableStatement cstmt = connection
652- .prepareCall ("exec [" + linkedServer + "].master.dbo.TestAdd ?,?,?" )) {
653- int sum = 11 ;
654- int param0 = 1 ;
655- int param1 = 10 ;
656- cstmt .setInt (1 , param0 );
657- cstmt .setInt (2 , param1 );
658- cstmt .registerOutParameter (3 , Types .INTEGER );
659- cstmt .execute ();
660- assertEquals (sum , cstmt .getInt (3 ));
661- }
662-
663- try (CallableStatement cstmt = connection
664- .prepareCall ("{? = call [" + linkedServer + "].master.dbo.TestReturn(?)}" )) {
665- int expected = 15 ;
666- cstmt .registerOutParameter (1 , java .sql .Types .INTEGER );
667- cstmt .setInt (2 , 5 );
668- cstmt .execute ();
669- assertEquals (expected , cstmt .getInt (1 ));
670- }
671- } finally {
672- try (Statement stmt = connection .createStatement ()) {
673- TestUtils .dropTableIfExists (table , stmt );
674- }
675- }
676- }
594+ // @Test
595+ // @Tag(Constants.reqExternalSetup)
596+ // @Tag(Constants.xAzureSQLDB)
597+ // @Tag(Constants.xAzureSQLDW)
598+ // @Tag(Constants.xAzureSQLMI)
599+ // public void testFourPartSyntaxCallEscapeSyntax() throws SQLException {
600+ // String table = AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("serverList"));
601+ // try {
602+
603+ // try (Statement stmt = connection.createStatement()) {
604+ // TestUtils.dropTableIfExists(table, stmt);
605+ // stmt.execute("CREATE TABLE " + table
606+ // + " (serverName varchar(100),network varchar(100),serverStatus varchar(4000), id int, collation varchar(100), connectTimeout int, queryTimeout int)");
607+ // stmt.execute("INSERT " + table + " EXEC sp_helpserver");
608+
609+ // ResultSet rs = stmt
610+ // .executeQuery("SELECT COUNT(*) FROM " + table + " WHERE serverName = N'" + linkedServer + "'");
611+ // rs.next();
612+
613+ // if (rs.getInt(1) == 1) {
614+ // // Drop all linked logins associated with the server
615+ // stmt.execute("EXEC sp_dropserver @server='" + linkedServer + "', @droplogins='droplogins';");
616+ // }
617+
618+ // stmt.execute("EXEC sp_addlinkedserver @server='" + linkedServer + "';");
619+ // stmt.execute("EXEC sp_addlinkedsrvlogin @rmtsrvname=N'" + linkedServer + "', @useself=false"
620+ // + ", @rmtuser=N'" + linkedServerUser + "', @rmtpassword=N'" + linkedServerPassword + "'");
621+ // stmt.execute("EXEC sp_serveroption '" + linkedServer + "', 'rpc', true;");
622+ // stmt.execute("EXEC sp_serveroption '" + linkedServer + "', 'rpc out', true;");
623+ // }
624+
625+ // SQLServerDataSource ds = new SQLServerDataSource();
626+ // ds.setServerName(linkedServer);
627+ // ds.setUser(linkedServerUser);
628+ // ds.setPassword(linkedServerPassword);
629+ // ds.setEncrypt(false);
630+ // ds.setTrustServerCertificate(true);
631+
632+ // try (Connection linkedServerConnection = ds.getConnection();
633+ // Statement stmt = linkedServerConnection.createStatement()) {
634+ // stmt.execute(
635+ // "create or alter procedure dbo.TestAdd(@Num1 int, @Num2 int, @Result int output) as begin set @Result = @Num1 + @Num2; end;");
636+
637+ // stmt.execute("create or alter procedure dbo.TestReturn(@Num1 int) as select @Num1 return @Num1*3 ");
638+ // }
639+
640+ // try (CallableStatement cstmt = connection
641+ // .prepareCall("{call [" + linkedServer + "].master.dbo.TestAdd(?,?,?)}")) {
642+ // int sum = 11;
643+ // int param0 = 1;
644+ // int param1 = 10;
645+ // cstmt.setInt(1, param0);
646+ // cstmt.setInt(2, param1);
647+ // cstmt.registerOutParameter(3, Types.INTEGER);
648+ // cstmt.execute();
649+ // assertEquals(sum, cstmt.getInt(3));
650+ // }
651+
652+ // try (CallableStatement cstmt = connection
653+ // .prepareCall("exec [" + linkedServer + "].master.dbo.TestAdd ?,?,?")) {
654+ // int sum = 11;
655+ // int param0 = 1;
656+ // int param1 = 10;
657+ // cstmt.setInt(1, param0);
658+ // cstmt.setInt(2, param1);
659+ // cstmt.registerOutParameter(3, Types.INTEGER);
660+ // cstmt.execute();
661+ // assertEquals(sum, cstmt.getInt(3));
662+ // }
663+
664+ // try (CallableStatement cstmt = connection
665+ // .prepareCall("{? = call [" + linkedServer + "].master.dbo.TestReturn(?)}")) {
666+ // int expected = 15;
667+ // cstmt.registerOutParameter(1, java.sql.Types.INTEGER);
668+ // cstmt.setInt(2, 5);
669+ // cstmt.execute();
670+ // assertEquals(expected, cstmt.getInt(1));
671+ // }
672+ // } finally {
673+ // try (Statement stmt = connection.createStatement()) {
674+ // TestUtils.dropTableIfExists(table, stmt);
675+ // }
676+ // }
677+ // }
677678
678679 @ Test
679680 public void testTimestampStringConversion () throws SQLException {
0 commit comments