diff --git a/.github/composite-actions/minor-version-upgrade-util/action.yml b/.github/composite-actions/minor-version-upgrade-util/action.yml index 66767d0452a..6f5a66fc81f 100644 --- a/.github/composite-actions/minor-version-upgrade-util/action.yml +++ b/.github/composite-actions/minor-version-upgrade-util/action.yml @@ -85,7 +85,6 @@ runs: tar_dir: ${{ matrix.upgrade-path.last_version }} run: | cd test/JDBC/ - export isUpgradeTestMode=true if [[ ${{ inputs.server_collation_name }} != "default" ]]; then export serverCollationName=${{ inputs.server_collation_name }} fi diff --git a/.github/composite-actions/run-verify-tests/action.yml b/.github/composite-actions/run-verify-tests/action.yml index e69434b201b..4e608cca960 100644 --- a/.github/composite-actions/run-verify-tests/action.yml +++ b/.github/composite-actions/run-verify-tests/action.yml @@ -41,7 +41,6 @@ runs: touch dummy_schedule echo "all" > dummy_schedule export scheduleFile=dummy_schedule - export isUpgradeTestMode=true if [[ ${{ inputs.server_collation_name }} != "default" ]]; then export serverCollationName=${{ inputs.server_collation_name }} fi diff --git a/.github/composite-actions/setup-base-version/action.yml b/.github/composite-actions/setup-base-version/action.yml index 9d6f6b96126..1ddc653edcb 100644 --- a/.github/composite-actions/setup-base-version/action.yml +++ b/.github/composite-actions/setup-base-version/action.yml @@ -186,7 +186,6 @@ runs: export serverCollationName=${{ inputs.server_collation_name }} fi if [[ "$migr_mode" == "multi-db" ]];then - export isUpgradeTestMode=true base_dir=${{ matrix.upgrade-path.path[0] }} if [[ "$base_dir" == *"latest"* || ${{ inputs.dump_restore }} == 'true' ]]; then base_dir="latest" @@ -210,7 +209,6 @@ runs: exit 1 fi done - export isUpgradeTestMode=true export inputFilesPath=input for filename in $(grep -v "^ignore.*\|^#.*\|^cmd.*\|^all.*\|^$" upgrade/$base_dir/schedule); do sed -i "s/\b$filename[ ]*\b$/$filename-vu-prepare/g" upgrade/$base_dir/schedule diff --git a/test/JDBC/expected/BABEL-3291.out b/test/JDBC/expected/BABEL-3291.out index 270eb209f00..0e089dcf7b8 100644 --- a/test/JDBC/expected/BABEL-3291.out +++ b/test/JDBC/expected/BABEL-3291.out @@ -68,5 +68,13 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3291_t1 go diff --git a/test/JDBC/expected/BABEL-3292.out b/test/JDBC/expected/BABEL-3292.out index 2228699479b..c6c46d24cc0 100644 --- a/test/JDBC/expected/BABEL-3292.out +++ b/test/JDBC/expected/BABEL-3292.out @@ -1146,6 +1146,14 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3292_schema.t1 go diff --git a/test/JDBC/expected/BABEL-3293.out b/test/JDBC/expected/BABEL-3293.out index 0c598ac7525..ac73768dff1 100644 --- a/test/JDBC/expected/BABEL-3293.out +++ b/test/JDBC/expected/BABEL-3293.out @@ -1227,6 +1227,14 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3293_schema.t1 go diff --git a/test/JDBC/expected/BABEL-3294.out b/test/JDBC/expected/BABEL-3294.out index 62895b7b55f..c6383924b62 100644 --- a/test/JDBC/expected/BABEL-3294.out +++ b/test/JDBC/expected/BABEL-3294.out @@ -188,5 +188,13 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3294_t1 go diff --git a/test/JDBC/expected/BABEL-3295.out b/test/JDBC/expected/BABEL-3295.out index e2f1ccc5b5f..75916086f11 100644 --- a/test/JDBC/expected/BABEL-3295.out +++ b/test/JDBC/expected/BABEL-3295.out @@ -185,6 +185,14 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3295_t1 go diff --git a/test/JDBC/expected/BABEL-3512.out b/test/JDBC/expected/BABEL-3512.out index 2aa19d49cb4..56bbc701df9 100644 --- a/test/JDBC/expected/BABEL-3512.out +++ b/test/JDBC/expected/BABEL-3512.out @@ -900,6 +900,20 @@ Babelfish T-SQL Batch Parsing Time: 0.084 ms -- clean up +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +Query Text: select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false) +Result +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.117 ms +~~END~~ + + SET babelfish_showplan_all OFF GO diff --git a/test/JDBC/expected/BABEL-3513-vu-prepare.out b/test/JDBC/expected/BABEL-3513-vu-prepare.out index 74910f26e43..39416008dbb 100644 --- a/test/JDBC/expected/BABEL-3513-vu-prepare.out +++ b/test/JDBC/expected/BABEL-3513-vu-prepare.out @@ -101,3 +101,9 @@ go exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server' go + +exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server' +go + +exec sp_babelfish_configure 'enable_pg_hint', 'off' +go diff --git a/test/JDBC/expected/BABEL-3513_before_15_8_or_16_4-vu-prepare.out b/test/JDBC/expected/BABEL-3513_before_15_8_or_16_4-vu-prepare.out index eaef74d0f9a..528c5de30ef 100644 --- a/test/JDBC/expected/BABEL-3513_before_15_8_or_16_4-vu-prepare.out +++ b/test/JDBC/expected/BABEL-3513_before_15_8_or_16_4-vu-prepare.out @@ -86,3 +86,9 @@ go exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server' go + +exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server' +go + +exec sp_babelfish_configure 'enable_pg_hint', 'off' +go diff --git a/test/JDBC/expected/BABEL-3592.out b/test/JDBC/expected/BABEL-3592.out index d055db38128..ed99ac06ff5 100644 --- a/test/JDBC/expected/BABEL-3592.out +++ b/test/JDBC/expected/BABEL-3592.out @@ -445,6 +445,20 @@ Babelfish T-SQL Batch Parsing Time: 0.080 ms -- clean up +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +Query Text: select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false) +Result +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.121 ms +~~END~~ + + set babelfish_showplan_all off go diff --git a/test/JDBC/expected/parallel_query/BABEL-3291.out b/test/JDBC/expected/parallel_query/BABEL-3291.out index cf7d32d959f..64285f04e54 100644 --- a/test/JDBC/expected/parallel_query/BABEL-3291.out +++ b/test/JDBC/expected/parallel_query/BABEL-3291.out @@ -73,5 +73,13 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3291_t1 go diff --git a/test/JDBC/expected/parallel_query/BABEL-3292.out b/test/JDBC/expected/parallel_query/BABEL-3292.out index 2848b5e0ef5..5aee6c61561 100644 --- a/test/JDBC/expected/parallel_query/BABEL-3292.out +++ b/test/JDBC/expected/parallel_query/BABEL-3292.out @@ -1278,6 +1278,14 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3292_schema.t1 go diff --git a/test/JDBC/expected/parallel_query/BABEL-3293.out b/test/JDBC/expected/parallel_query/BABEL-3293.out index a9e8ecd0c35..29dd61a3abe 100644 --- a/test/JDBC/expected/parallel_query/BABEL-3293.out +++ b/test/JDBC/expected/parallel_query/BABEL-3293.out @@ -1334,6 +1334,14 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3293_schema.t1 go diff --git a/test/JDBC/expected/parallel_query/BABEL-3294.out b/test/JDBC/expected/parallel_query/BABEL-3294.out index c29f1ff2d21..081b52f75b7 100644 --- a/test/JDBC/expected/parallel_query/BABEL-3294.out +++ b/test/JDBC/expected/parallel_query/BABEL-3294.out @@ -188,5 +188,13 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3294_t1 go diff --git a/test/JDBC/expected/parallel_query/BABEL-3295.out b/test/JDBC/expected/parallel_query/BABEL-3295.out index 69aa35e6b37..494c135cb7b 100644 --- a/test/JDBC/expected/parallel_query/BABEL-3295.out +++ b/test/JDBC/expected/parallel_query/BABEL-3295.out @@ -205,6 +205,14 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +off +~~END~~ + + drop table babel_3295_t1 go diff --git a/test/JDBC/expected/parallel_query/BABEL-3512.out b/test/JDBC/expected/parallel_query/BABEL-3512.out index a4fb9118ac0..c900ab0b0fc 100644 --- a/test/JDBC/expected/parallel_query/BABEL-3512.out +++ b/test/JDBC/expected/parallel_query/BABEL-3512.out @@ -992,6 +992,20 @@ Babelfish T-SQL Batch Parsing Time: 0.071 ms -- clean up +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +Query Text: select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false) +Result +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.193 ms +~~END~~ + + SET babelfish_showplan_all OFF GO diff --git a/test/JDBC/expected/parallel_query/BABEL-3513-vu-prepare.out b/test/JDBC/expected/parallel_query/BABEL-3513-vu-prepare.out index 6b5a9923793..54b128e3731 100644 --- a/test/JDBC/expected/parallel_query/BABEL-3513-vu-prepare.out +++ b/test/JDBC/expected/parallel_query/BABEL-3513-vu-prepare.out @@ -110,3 +110,9 @@ go exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server' go + +exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server' +go + +exec sp_babelfish_configure 'enable_pg_hint', 'off' +go diff --git a/test/JDBC/expected/parallel_query/BABEL-3592.out b/test/JDBC/expected/parallel_query/BABEL-3592.out index 463855e2267..be06073ed3c 100644 --- a/test/JDBC/expected/parallel_query/BABEL-3592.out +++ b/test/JDBC/expected/parallel_query/BABEL-3592.out @@ -452,6 +452,20 @@ Babelfish T-SQL Batch Parsing Time: 0.078 ms -- clean up +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go +~~START~~ +text +Query Text: select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false) +Result +~~END~~ + +~~START~~ +text +Babelfish T-SQL Batch Parsing Time: 0.193 ms +~~END~~ + + set babelfish_showplan_all off go diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3291.mix b/test/JDBC/input/pg_hint_plan/BABEL-3291.mix index c2157b29ea9..48a8b3faaae 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3291.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3291.mix @@ -35,5 +35,8 @@ set babelfish_showplan_all off go -- cleanup -drop table babel_3291_t1 +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); go + +drop table babel_3291_t1 +go \ No newline at end of file diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3292.mix b/test/JDBC/input/pg_hint_plan/BABEL-3292.mix index 4574cfdf359..57df5c8bfd9 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3292.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3292.mix @@ -276,6 +276,9 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go + drop table babel_3292_schema.t1 go diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3293.mix b/test/JDBC/input/pg_hint_plan/BABEL-3293.mix index cfb3f55705e..b21b30850c1 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3293.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3293.mix @@ -251,6 +251,9 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go + drop table babel_3293_schema.t1 go @@ -261,4 +264,4 @@ drop table babel_3293_t3 go drop schema babel_3293_schema -go +go \ No newline at end of file diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3294.mix b/test/JDBC/input/pg_hint_plan/BABEL-3294.mix index 3cb19b66c8d..9a274f523c8 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3294.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3294.mix @@ -66,5 +66,8 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go + drop table babel_3294_t1 go diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3295.mix b/test/JDBC/input/pg_hint_plan/BABEL-3295.mix index 3208d48bd4e..d16bf30234a 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3295.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3295.mix @@ -66,6 +66,9 @@ set babelfish_showplan_all off go -- cleanup +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go + drop table babel_3295_t1 go diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3512.mix b/test/JDBC/input/pg_hint_plan/BABEL-3512.mix index 89f0b5c68ec..b56ae3cc428 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3512.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3512.mix @@ -361,6 +361,9 @@ EXEC babel_3512_comment_test_2 GO -- clean up +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go + SET babelfish_showplan_all OFF GO diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-prepare.mix b/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-prepare.mix index 0394e43bf6e..d0c9de83aa5 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-prepare.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3513-vu-prepare.mix @@ -49,3 +49,9 @@ go exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server' go + +exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server' +go + +exec sp_babelfish_configure 'enable_pg_hint', 'off' +go diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3513_before_15_8_or_16_4-vu-prepare.mix b/test/JDBC/input/pg_hint_plan/BABEL-3513_before_15_8_or_16_4-vu-prepare.mix index 0394e43bf6e..92e11b4df42 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3513_before_15_8_or_16_4-vu-prepare.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3513_before_15_8_or_16_4-vu-prepare.mix @@ -49,3 +49,9 @@ go exec sp_babelfish_configure 'enable_pg_hint', 'on', 'server' go + +exec sp_babelfish_configure 'enable_pg_hint', 'off', 'server' +go + +exec sp_babelfish_configure 'enable_pg_hint', 'off' +go \ No newline at end of file diff --git a/test/JDBC/input/pg_hint_plan/BABEL-3592.mix b/test/JDBC/input/pg_hint_plan/BABEL-3592.mix index 48b2a516f70..23720803ca2 100644 --- a/test/JDBC/input/pg_hint_plan/BABEL-3592.mix +++ b/test/JDBC/input/pg_hint_plan/BABEL-3592.mix @@ -182,6 +182,9 @@ EXEC babel_3592_proc_mixed_statements GO -- clean up +select set_config('babelfishpg_tsql.enable_pg_hint', 'off', false); +go + set babelfish_showplan_all off go diff --git a/test/JDBC/src/main/java/com/sqlsamples/Config.java b/test/JDBC/src/main/java/com/sqlsamples/Config.java index 45acd84be4b..f1ef274fca9 100644 --- a/test/JDBC/src/main/java/com/sqlsamples/Config.java +++ b/test/JDBC/src/main/java/com/sqlsamples/Config.java @@ -32,12 +32,15 @@ public class Config { static boolean checkParallelQueryExpected = false; static boolean checkSingleDbModeExpected = false; static String testFileRoot = properties.getProperty("testFileRoot"); - static boolean isUpgradeTestMode = Boolean.parseBoolean(properties.getProperty("isUpgradeTestMode")); static long defaultSLA = Long.parseLong(properties.getProperty("defaultSLA")); + static boolean allowConnectionReset = Boolean.parseBoolean(properties.getProperty("allowConnectionReset")); static boolean isdbCollationMode = Boolean.parseBoolean(properties.getProperty("isdbCollationMode")); static String dbCollationIgnoreFileName = "./db_collation_jdbc_schedule"; static String singleDBIgnoreFileName = "./singledb_jdbc_schedule"; + static int majorVersion = 13; + static int minorVersion = 6; + static String connectionString = constructConnectionString(); // read configuration from text file "config.txt" and load it as properties diff --git a/test/JDBC/src/main/java/com/sqlsamples/JDBCCrossDialect.java b/test/JDBC/src/main/java/com/sqlsamples/JDBCCrossDialect.java index 54f5a9aa2a7..199b46c322e 100644 --- a/test/JDBC/src/main/java/com/sqlsamples/JDBCCrossDialect.java +++ b/test/JDBC/src/main/java/com/sqlsamples/JDBCCrossDialect.java @@ -162,13 +162,12 @@ Connection getPsqlConnection (String strLine, BufferedWriter bw, Logger logger) } void closeConnectionsUtil (HashMap connectionMap, BufferedWriter bw, Logger logger) { - boolean needSkipFirst = isUpgradeTestMode ? false : true; + boolean needSkipFirst = (majorVersion > 16) || (majorVersion == 16 && minorVersion >= 6) ? true : false; Iterator> iterator = connectionMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = iterator.next(); Connection connection = entry.getValue(); - if (!needSkipFirst) { try { connection.close(); @@ -176,8 +175,9 @@ void closeConnectionsUtil (HashMap connectionMap, BufferedWr handleSQLExceptionWithFile(e, bw, logger); } } - else + else { needSkipFirst = false; + } } } @@ -207,7 +207,6 @@ void terminateTsqlConnection (String strLine, BufferedWriter bw, Logger logger) } } - void terminatePsqlConnection (String strLine, BufferedWriter bw, Logger logger) { getConnectionAttributes(strLine); diff --git a/test/JDBC/src/main/resources/config.txt b/test/JDBC/src/main/resources/config.txt index a88837b9aa4..c7b8ef946bd 100644 --- a/test/JDBC/src/main/resources/config.txt +++ b/test/JDBC/src/main/resources/config.txt @@ -51,8 +51,8 @@ isdbCollationMode = false # Where to find the input, output, expected, etc. testFileRoot = ./ -# WHETHER TEST RUN MODE IS UPGRADE TEST RUN -isUpgradeTestMode = false - # Default SLA in milliseconds defaultSLA = 40000 + +# WHETHER THE CONNECTION SHOULD BE ALLOWED TO RESET AFTER EACH TEST OR CLOSED AFTER EACH TEST +allowConnectionReset = true diff --git a/test/JDBC/src/test/java/com/sqlsamples/TestQueryFile.java b/test/JDBC/src/test/java/com/sqlsamples/TestQueryFile.java index 68ecb7f892e..0ba199624df 100644 --- a/test/JDBC/src/test/java/com/sqlsamples/TestQueryFile.java +++ b/test/JDBC/src/test/java/com/sqlsamples/TestQueryFile.java @@ -10,6 +10,7 @@ import java.sql.*; import java.text.SimpleDateFormat; import java.util.*; +import java.util.regex.*; import java.util.Date; import java.util.stream.Stream; @@ -261,25 +262,93 @@ public static void setup() throws IOException { String logFile = testRunDir + timestamp; configureLogger(logFile, logger); + + String URL = properties.getProperty("URL"); + String tsql_port = properties.getProperty("tsql_port"); + String databaseName = properties.getProperty("databaseName"); + String user = properties.getProperty("user"); + String password = properties.getProperty("password"); + + Connection getVersionCon = null; + Statement stmt = null; + ResultSet rs = null; + // Query against database to find test version + try { + getVersionCon = DriverManager.getConnection(createSQLServerConnectionString(URL, tsql_port, databaseName, user, password)); + rs = getVersionCon.createStatement().executeQuery("SELECT @@VERSION;"); + + int columnCount = rs.getMetaData().getColumnCount(); + StringBuilder queryOutputBuilder = new StringBuilder(); + + while (rs.next()) { + for (int i = 1; i <= columnCount; i++) { + queryOutputBuilder.append(rs.getString(i) + " "); + } + } + + String queryOutput = queryOutputBuilder.toString(); + Pattern pattern = Pattern.compile("PostgreSQL (\\d+\\.\\d+)"); + Matcher matcher = pattern.matcher(queryOutput); + + if (matcher.find()) { + String versionString = matcher.group(1); + majorVersion = Integer.parseInt(versionString.split("\\.")[0]); + minorVersion = Integer.parseInt(versionString.split("\\.")[1]); + } + else { + majorVersion = 0; + minorVersion = 0; + } + + try { + if (getVersionCon != null) { + getVersionCon.close(); + } + getVersionCon = null; + } + catch (Exception e) { + e.printStackTrace(); + } + return; + } + catch (SQLException e) { + majorVersion = 0; + minorVersion = 0; + System.out.println("Error executing query: " + e.getMessage()); + } + summaryLogger.info("Started test suite. Now running tests..."); } // close connections that are not null after every test @AfterEach public void closeConnections() throws SQLException, ClassNotFoundException, Throwable { - if (isUpgradeTestMode) { - if (connection_bbl != null) connection_bbl.close(); - connection_bbl = null; - return; + if ((majorVersion > 16 || (majorVersion == 16 && minorVersion >= 6)) && allowConnectionReset) { + if (connection_bbl == null) { + return; + } + else { + try { + connection_bbl.createStatement().execute("EXEC sys.sp_reset_connection"); + } + catch (Exception e) { + e.printStackTrace(); + } + return; + } } - if (connection_bbl == null) + else { + try { + if (connection_bbl != null) { + connection_bbl.close(); + } + connection_bbl = null; + } + catch (Exception e) { + e.printStackTrace(); + } return; - try{ - connection_bbl.createStatement().execute("EXEC sys.sp_reset_connection"); - } - catch (Exception e) { - e.printStackTrace(); } }