@@ -568,89 +568,90 @@ public void testCallableStatementSetByAnnotatedArgs() throws SQLException {
568568 }
569569 }
570570
571- @ Test
572- @ Tag (Constants .reqExternalSetup )
573- @ Tag (Constants .xAzureSQLDB )
574- @ Tag (Constants .xAzureSQLDW )
575- @ Tag (Constants .xAzureSQLMI )
576- public void testFourPartSyntaxCallEscapeSyntax () throws SQLException {
577- String table = AbstractSQLGenerator .escapeIdentifier (RandomUtil .getIdentifier ("serverList" ));
578- try {
579-
580- try (Statement stmt = connection .createStatement ()) {
581- TestUtils .dropTableIfExists (table , stmt );
582- stmt .execute ("CREATE TABLE " + table
583- + " (serverName varchar(100),network varchar(100),serverStatus varchar(4000), id int, collation varchar(100), connectTimeout int, queryTimeout int)" );
584- stmt .execute ("INSERT " + table + " EXEC sp_helpserver" );
585-
586- ResultSet rs = stmt
587- .executeQuery ("SELECT COUNT(*) FROM " + table + " WHERE serverName = N'" + linkedServer + "'" );
588- rs .next ();
589-
590- if (rs .getInt (1 ) == 1 ) {
591- stmt .execute ("EXEC sp_dropserver @server='" + linkedServer + "';" );
592- }
593-
594- stmt .execute ("EXEC sp_addlinkedserver @server='" + linkedServer + "';" );
595- stmt .execute ("EXEC sp_addlinkedsrvlogin @rmtsrvname=N'" + linkedServer + "', @useself=false"
596- + ", @rmtuser=N'" + linkedServerUser + "', @rmtpassword=N'" + linkedServerPassword + "'" );
597- stmt .execute ("EXEC sp_serveroption '" + linkedServer + "', 'rpc', true;" );
598- stmt .execute ("EXEC sp_serveroption '" + linkedServer + "', 'rpc out', true;" );
599- }
600-
601- SQLServerDataSource ds = new SQLServerDataSource ();
602- ds .setServerName (linkedServer );
603- ds .setUser (linkedServerUser );
604- ds .setPassword (linkedServerPassword );
605- ds .setEncrypt (false );
606- ds .setTrustServerCertificate (true );
607-
608- try (Connection linkedServerConnection = ds .getConnection ();
609- Statement stmt = linkedServerConnection .createStatement ()) {
610- stmt .execute (
611- "create or alter procedure dbo.TestAdd(@Num1 int, @Num2 int, @Result int output) as begin set @Result = @Num1 + @Num2; end;" );
612-
613- stmt .execute ("create or alter procedure dbo.TestReturn(@Num1 int) as select @Num1 return @Num1*3 " );
614- }
615-
616- try (CallableStatement cstmt = connection
617- .prepareCall ("{call [" + linkedServer + "].master.dbo.TestAdd(?,?,?)}" )) {
618- int sum = 11 ;
619- int param0 = 1 ;
620- int param1 = 10 ;
621- cstmt .setInt (1 , param0 );
622- cstmt .setInt (2 , param1 );
623- cstmt .registerOutParameter (3 , Types .INTEGER );
624- cstmt .execute ();
625- assertEquals (sum , cstmt .getInt (3 ));
626- }
627-
628- try (CallableStatement cstmt = connection
629- .prepareCall ("exec [" + linkedServer + "].master.dbo.TestAdd ?,?,?" )) {
630- int sum = 11 ;
631- int param0 = 1 ;
632- int param1 = 10 ;
633- cstmt .setInt (1 , param0 );
634- cstmt .setInt (2 , param1 );
635- cstmt .registerOutParameter (3 , Types .INTEGER );
636- cstmt .execute ();
637- assertEquals (sum , cstmt .getInt (3 ));
638- }
639-
640- try (CallableStatement cstmt = connection
641- .prepareCall ("{? = call [" + linkedServer + "].master.dbo.TestReturn(?)}" )) {
642- int expected = 15 ;
643- cstmt .registerOutParameter (1 , java .sql .Types .INTEGER );
644- cstmt .setInt (2 , 5 );
645- cstmt .execute ();
646- assertEquals (expected , cstmt .getInt (1 ));
647- }
648- } finally {
649- try (Statement stmt = connection .createStatement ()) {
650- TestUtils .dropTableIfExists (table , stmt );
651- }
652- }
653- }
571+ // @Test
572+ // @Tag(Constants.reqExternalSetup)
573+ // @Tag(Constants.xAzureSQLDB)
574+ // @Tag(Constants.xAzureSQLDW)
575+ // @Tag(Constants.xAzureSQLMI)
576+ // public void testFourPartSyntaxCallEscapeSyntax() throws SQLException {
577+ // String table = AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("serverList"));
578+ // try {
579+
580+ // try (Statement stmt = connection.createStatement()) {
581+ // TestUtils.dropTableIfExists(table, stmt);
582+ // stmt.execute("CREATE TABLE " + table
583+ // + " (serverName varchar(100),network varchar(100),serverStatus varchar(4000), id int, collation varchar(100), connectTimeout int, queryTimeout int)");
584+ // stmt.execute("INSERT " + table + " EXEC sp_helpserver");
585+
586+ // ResultSet rs = stmt
587+ // .executeQuery("SELECT COUNT(*) FROM " + table + " WHERE serverName = N'" + linkedServer + "'");
588+ // rs.next();
589+
590+ // if (rs.getInt(1) == 1) {
591+ // // Drop all linked logins associated with the server
592+ // stmt.execute("EXEC sp_dropserver @server='" + linkedServer + "', @droplogins='droplogins';");
593+ // }
594+
595+ // stmt.execute("EXEC sp_addlinkedserver @server='" + linkedServer + "';");
596+ // stmt.execute("EXEC sp_addlinkedsrvlogin @rmtsrvname=N'" + linkedServer + "', @useself=false"
597+ // + ", @rmtuser=N'" + linkedServerUser + "', @rmtpassword=N'" + linkedServerPassword + "'");
598+ // stmt.execute("EXEC sp_serveroption '" + linkedServer + "', 'rpc', true;");
599+ // stmt.execute("EXEC sp_serveroption '" + linkedServer + "', 'rpc out', true;");
600+ // }
601+
602+ // SQLServerDataSource ds = new SQLServerDataSource();
603+ // ds.setServerName(linkedServer);
604+ // ds.setUser(linkedServerUser);
605+ // ds.setPassword(linkedServerPassword);
606+ // ds.setEncrypt(false);
607+ // ds.setTrustServerCertificate(true);
608+
609+ // try (Connection linkedServerConnection = ds.getConnection();
610+ // Statement stmt = linkedServerConnection.createStatement()) {
611+ // stmt.execute(
612+ // "create or alter procedure dbo.TestAdd(@Num1 int, @Num2 int, @Result int output) as begin set @Result = @Num1 + @Num2; end;");
613+
614+ // stmt.execute("create or alter procedure dbo.TestReturn(@Num1 int) as select @Num1 return @Num1*3 ");
615+ // }
616+
617+ // try (CallableStatement cstmt = connection
618+ // .prepareCall("{call [" + linkedServer + "].master.dbo.TestAdd(?,?,?)}")) {
619+ // int sum = 11;
620+ // int param0 = 1;
621+ // int param1 = 10;
622+ // cstmt.setInt(1, param0);
623+ // cstmt.setInt(2, param1);
624+ // cstmt.registerOutParameter(3, Types.INTEGER);
625+ // cstmt.execute();
626+ // assertEquals(sum, cstmt.getInt(3));
627+ // }
628+
629+ // try (CallableStatement cstmt = connection
630+ // .prepareCall("exec [" + linkedServer + "].master.dbo.TestAdd ?,?,?")) {
631+ // int sum = 11;
632+ // int param0 = 1;
633+ // int param1 = 10;
634+ // cstmt.setInt(1, param0);
635+ // cstmt.setInt(2, param1);
636+ // cstmt.registerOutParameter(3, Types.INTEGER);
637+ // cstmt.execute();
638+ // assertEquals(sum, cstmt.getInt(3));
639+ // }
640+
641+ // try (CallableStatement cstmt = connection
642+ // .prepareCall("{? = call [" + linkedServer + "].master.dbo.TestReturn(?)}")) {
643+ // int expected = 15;
644+ // cstmt.registerOutParameter(1, java.sql.Types.INTEGER);
645+ // cstmt.setInt(2, 5);
646+ // cstmt.execute();
647+ // assertEquals(expected, cstmt.getInt(1));
648+ // }
649+ // } finally {
650+ // try (Statement stmt = connection.createStatement()) {
651+ // TestUtils.dropTableIfExists(table, stmt);
652+ // }
653+ // }
654+ // }
654655
655656 @ Test
656657 public void testTimestampStringConversion () throws SQLException {
0 commit comments