diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/AESetup.java b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/AESetup.java index e42767bda..5decbcabe 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/AESetup.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/AESetup.java @@ -1082,7 +1082,7 @@ protected static void populateCharSetObjectWithJDBCTypes(String[] charValues) th String sql = "insert into " + CHAR_TABLE_AE + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?" + ")"; - try (SQLServerConnection con = (SQLServerConnection) PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (SQLServerConnection con = (SQLServerConnection) PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) TestUtils.getPreparedStmt(con, sql, stmtColEncSetting)) { @@ -1144,7 +1144,7 @@ protected static void populateCharNullCase() throws SQLException { String sql = "insert into " + CHAR_TABLE_AE + " values( " + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?," + "?,?,?" + ")"; - try (SQLServerConnection con = (SQLServerConnection) PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (SQLServerConnection con = (SQLServerConnection) PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) TestUtils.getPreparedStmt(con, sql, stmtColEncSetting)) { diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/CallableStatementTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/CallableStatementTest.java index cb1c7c1f3..0e5830ccc 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/CallableStatementTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/CallableStatementTest.java @@ -540,7 +540,7 @@ private void createMultiInsertionSelection() throws SQLException { + TestUtils.escapeSingleQuotes(multiStatementsProcedure) + "') and OBJECTPROPERTY(id, N'IsProcedure') = 1)" + " DROP PROCEDURE " + multiStatementsProcedure; - try (Connection con = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (Connection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); SQLServerStatement stmt = (SQLServerStatement) con.createStatement()) { stmt.execute(sql); @@ -556,7 +556,7 @@ private void createMultiInsertionSelection() throws SQLException { private void MultiInsertionSelection() throws SQLException { String sql = "{call " + multiStatementsProcedure + " (?,?,?,?,?,?)}"; - try (Connection con = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (Connection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); SQLServerCallableStatement callableStatement = (SQLServerCallableStatement) TestUtils .getCallableStmt(con, sql, stmtColEncSetting)) { @@ -673,7 +673,7 @@ private void createInputProcedure2() throws SQLException { + TestUtils.escapeSingleQuotes(inputProcedure2) + "') and OBJECTPROPERTY(id, N'IsProcedure') = 1)" + " DROP PROCEDURE " + inputProcedure2; - try (Connection con = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (Connection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); SQLServerStatement stmt = (SQLServerStatement) con.createStatement()) { stmt.execute(sql); @@ -690,7 +690,7 @@ private void createInputProcedure2() throws SQLException { private void testInputProcedure2(String sql) throws SQLException { - try (Connection con = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (Connection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); SQLServerCallableStatement callableStatement = (SQLServerCallableStatement) TestUtils .getCallableStmt(con, sql, stmtColEncSetting)) { diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/EnclaveTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/EnclaveTest.java index fe47cd5be..f6a61a3e3 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/EnclaveTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/EnclaveTest.java @@ -210,7 +210,7 @@ public void testVerifyBadJksSignature(String serverName, String url, String prot String badTable = TestUtils.escapeSingleQuotes( AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("testVerifyBadJksSignature"))); - try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); Statement s = c.createStatement()) { createCMK(AETestConnectionString, badCmk, Constants.JAVA_KEY_STORE_NAME, javaKeyAliases, "0x666"); createCEK(AETestConnectionString, badCmk, badCek, jksProvider); @@ -256,7 +256,7 @@ public void testVerifyBadAkvSignature(String serverName, String url, String prot String badTable = TestUtils.escapeSingleQuotes( AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("testVerifyBadAkvSignature"))); - try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); Statement s = c.createStatement()) { createCMK(AETestConnectionString, badCmk, Constants.AZURE_KEY_VAULT_NAME, keyIDs[0], "0x666"); createCEK(AETestConnectionString, badCmk, badCek, akvProvider); @@ -301,7 +301,7 @@ public void testVerifyBadWinSignature(String serverName, String url, String prot String badTable = TestUtils.escapeSingleQuotes( AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("testVerifyBadWinSignature"))); - try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); Statement s = c.createStatement()) { // create CMK with a bad signature createCMK(AETestConnectionString, badCmk, Constants.WINDOWS_KEY_STORE_NAME, windowsKeyPath, "0x666"); @@ -397,7 +397,7 @@ public void testAEFMTOnly(String serverName, String url, String protocol) throws @MethodSource("enclaveParams") public void testAlter(String serverName, String url, String protocol) throws Exception { setAEConnectionString(serverName, url, protocol); - try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); Statement s = c.createStatement()) { createTable(CHAR_TABLE_AE, cekJks, varcharTableSimple); PreparedStatement pstmt = c.prepareStatement("INSERT INTO " + CHAR_TABLE_AE + " VALUES (?,?,?)"); @@ -445,7 +445,7 @@ public void testNumericRichQuery(String serverName, String url, String protocol) @MethodSource("enclaveParams") public void testStringRichQuery(String serverName, String url, String protocol) throws Exception { setAEConnectionString(serverName, url, protocol); - try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); Statement s = c.createStatement()) { createTable(CHAR_TABLE_AE, cekJks, varcharTableSimple); @@ -473,7 +473,7 @@ public void testStringRichQuery(String serverName, String url, String protocol) @MethodSource("enclaveParams") public void testAlterNoEncrypt(String serverName, String url, String protocol) throws Exception { setAEConnectionString(serverName, url, protocol); - try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (SQLServerConnection c = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); Statement s = c.createStatement()) { createTable(CHAR_TABLE_AE, cekJks, varcharTableSimple); PreparedStatement pstmt = c.prepareStatement("INSERT INTO " + CHAR_TABLE_AE + " VALUES (?,?,?)"); diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/MultiUserAKVTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/MultiUserAKVTest.java index 2619a79b5..5bd65c26a 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/MultiUserAKVTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/MultiUserAKVTest.java @@ -526,7 +526,7 @@ public void testStatementCustomKeyStoreProviderDuringAeQuery() throws Exception private void insertData(String tableName, int customId, String customName) { String sqlQuery = "INSERT INTO " + tableName + " VALUES ( ?, ? )"; - try (SQLServerConnection con = PrepUtil.getConnection(AETestConnectionString, AEInfo); + try (SQLServerConnection con = PrepUtil.getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;", AEInfo); SQLServerPreparedStatement pstmt = (SQLServerPreparedStatement) TestUtils.getPreparedStmt(con, sqlQuery, SQLServerStatementColumnEncryptionSetting.ENABLED)) { pstmt.setInt(1, customId); diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/RegressionAlwaysEncryptedTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/RegressionAlwaysEncryptedTest.java index d8725cdbe..22ab28627 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/RegressionAlwaysEncryptedTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/AlwaysEncrypted/RegressionAlwaysEncryptedTest.java @@ -75,7 +75,7 @@ public void alwaysEncrypted1(String serverName, String url, String protocol) thr public void alwaysEncrypted2(String serverName, String url, String protocol) throws Exception { setAEConnectionString(serverName, url, protocol); try (Connection connection = PrepUtil - .getConnection(AETestConnectionString + ";columnEncryptionSetting=enabled;", AEInfo); + .getConnection(AETestConnectionString + ";sendStringParametersAsUnicode=false;columnEncryptionSetting=enabled;", AEInfo); Statement stmt = connection.createStatement()) { dropTables(stmt);