Skip to content

Commit

Permalink
Merge branch 'release/12.6' into 12.6.3-timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffery-Wasty authored Jun 20, 2024
2 parents 4b674e8 + df57d98 commit 42c463c
Show file tree
Hide file tree
Showing 19 changed files with 78 additions and 27 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)

## [12.6.3] Hotfix & Stable Release
### Fixed issues
- Fixed issue where TokenCredential class was required to be imported [#2453](https://github.com/microsoft/mssql-jdbc/pull/2453)
- Fixed timestamp string conversion regression [#2455](https://github.com/microsoft/mssql-jdbc/pull/2455)
- Fixed SQLServerCallableStatement default value regression [#2456](https://github.com/microsoft/mssql-jdbc/pull/2456)

## [12.6.2] Hotfix & Stable Release
### Added
- Added credential caching for Managed Identity Credential and Default Azure Credential [#2426](https://github.com/microsoft/mssql-jdbc/pull/2426)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ We're now on the Maven Central Repository. Add the following to your POM file to
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
```
The driver can be downloaded from [Microsoft](https://aka.ms/downloadmssqljdbc). For driver version 12.1.0 and greater, please use the jre11 version when using Java 11 or greater, and the jre8 version when using Java 8.
Expand All @@ -92,7 +92,7 @@ To get the latest version of the driver, add the following to your POM file:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
```

Expand Down Expand Up @@ -127,7 +127,7 @@ Projects that require either of the two features need to explicitly declare the
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
<scope>compile</scope>
</dependency>

Expand All @@ -145,7 +145,7 @@ Projects that require either of the two features need to explicitly declare the
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
<scope>compile</scope>
</dependency>

Expand All @@ -172,7 +172,7 @@ When setting 'useFmtOnly' property to 'true' for establishing a connection or cr
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

apply plugin: 'java'

version = '12.6.2'
version = '12.6.3'
def releaseExt = ''
def jreVersion = ""
def testOutputDir = file("build/classes/java/test")
Expand Down
2 changes: 1 addition & 1 deletion mssql-jdbc_auth_LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MICROSOFT SOFTWARE LICENSE TERMS
MICROSOFT JDBC DRIVER 12.6.2 FOR SQL SERVER
MICROSOFT JDBC DRIVER 12.6.3 FOR SQL SERVER

These license terms are an agreement between you and Microsoft Corporation (or one of its affiliates). They apply to the software named above and any Microsoft services or software updates (except to the extent such services or updates are accompanied by new or additional terms, in which case those different terms apply prospectively and do not alter your or Microsoft’s rights relating to pre-updated software or services). IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE RIGHTS BELOW. BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS.

Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2</version>
<version>12.6.3</version>
<packaging>jar</packaging>
<name>Microsoft JDBC Driver for SQL Server</name>
<description>
Expand Down Expand Up @@ -55,13 +55,13 @@
<!-- Driver Dependencies -->
<org.osgi.core.version>6.0.0</org.osgi.core.version>
<azure-security-keyvault-keys.version>4.7.3</azure-security-keyvault-keys.version>
<azure-identity.version>1.11.1</azure-identity.version>
<msal.version>1.14.1</msal.version>
<azure-identity.version>1.12.2</azure-identity.version>
<msal.version>1.15.1</msal.version>
<osgi.jdbc.version>1.1.0</osgi.jdbc.version>
<antlr-runtime.version>4.9.3</antlr-runtime.version>
<com.google.code.gson.version>2.10.1</com.google.code.gson.version>
<bcprov-jdk18on.version>1.77</bcprov-jdk18on.version>
<bcpkix-jdk18on.version>1.77</bcpkix-jdk18on.version>
<bcprov-jdk18on.version>1.78</bcprov-jdk18on.version>
<bcpkix-jdk18on.version>1.78</bcpkix-jdk18on.version>
<!-- JUnit Test Dependencies -->
<junit.platform.version>[1.3.2, 1.9.0]</junit.platform.version>
<junit.jupiter.version>5.8.2</junit.jupiter.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
final class SQLJdbcVersion {
static final int MAJOR = 12;
static final int MINOR = 6;
static final int PATCH = 2;
static final int PATCH = 3;
static final int BUILD = 0;
/*
* Used to load mssql-jdbc_auth DLL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private void setPreparedStatementHandle(int handle) {
* Regex for JDBC 'call' escape syntax
*/
private static final Pattern callEscapePattern = Pattern
.compile("^\\s*(?i)\\{(\\s*\\??\\s*=?\\s*)call (.+)\\s*\\(?\\?*,?\\)?\\s*}\\s*$");
.compile("^\\s*(?i)\\{(\\s*\\??\\s*=?\\s*)call [^\\(\\)]+\\s*(\\(\\s*\\?\\s*(,\\s*\\?\\s*)*\\))?\\s*}");

/**
* Regex for 'exec' escape syntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import javax.crypto.spec.SecretKeySpec;

import com.azure.core.credential.AccessToken;
import com.azure.core.credential.TokenCredential;
import com.azure.core.credential.TokenRequestContext;
import com.azure.identity.ManagedIdentityCredential;
import com.azure.identity.ManagedIdentityCredentialBuilder;
Expand Down Expand Up @@ -487,7 +486,7 @@ private static String[] getAdditonallyAllowedTenants() {
return null;
}

private static TokenCredential getCredentialFromCache(String key) {
private static Object getCredentialFromCache(String key) {
Credential credential = CREDENTIAL_CACHE.get(key);

if (null != credential) {
Expand All @@ -498,9 +497,9 @@ private static TokenCredential getCredentialFromCache(String key) {
}

private static class Credential {
TokenCredential tokenCredential;
Object tokenCredential;

public Credential(TokenCredential tokenCredential) {
public Credential(Object tokenCredential) {
this.tokenCredential = tokenCredential;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/samples/adaptive/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
</dependencies>
<profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/alwaysencrypted/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
</dependencies>
<profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/azureactivedirectoryauthentication/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
</dependencies>
<profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/connections/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
</dependencies>
<profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/constrained/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
</dependencies>
<profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/dataclassification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
</dependencies>
<profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/datatypes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
</dependencies>
<profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/resultsets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
</dependencies>
<profiles>
Expand Down
2 changes: 1 addition & 1 deletion src/samples/sparse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.6.2.jre11</version>
<version>12.6.3.jre11</version>
</dependency>
</dependencies>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ protected Object[][] getContents() {
{"R_givenValueType", "The given value of type"},
{"R_lengthTruncated", " The inserted length is truncated or not correct!"},
{"R_timeValueTruncated", " The time value is truncated or not correct!"},
{"R_nullPointerExceptionFromResultSet", "Cannot invoke \"java.sql.ResultSet.next()\" because \"rs\" is null"},
{"R_invalidErrorMessage", "Invalid Error Message: "},
{"R_kerberosNativeGSSFailure",
"No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public class CallableStatementTest extends AbstractTest {
.escapeIdentifier(RandomUtil.getIdentifier("CallableStatementTest_setNull_SP"));
private static String inputParamsProcedureName = AbstractSQLGenerator
.escapeIdentifier(RandomUtil.getIdentifier("CallableStatementTest_inputParams_SP"));
private static String conditionalSproc = AbstractSQLGenerator
.escapeIdentifier(RandomUtil.getIdentifier("CallableStatementTest_conditionalSproc"));
private static String getObjectLocalDateTimeProcedureName = AbstractSQLGenerator
.escapeIdentifier(RandomUtil.getIdentifier("CallableStatementTest_getObjectLocalDateTime_SP"));
private static String getObjectOffsetDateTimeProcedureName = AbstractSQLGenerator
Expand Down Expand Up @@ -100,6 +102,7 @@ public static void setupTest() throws Exception {
TestUtils.dropProcedureIfExists(zeroParamSproc, stmt);
TestUtils.dropProcedureIfExists(outOfOrderSproc, stmt);
TestUtils.dropProcedureIfExists(byParamNameSproc, stmt);
TestUtils.dropProcedureIfExists(conditionalSproc, stmt);
TestUtils.dropFunctionIfExists(userDefinedFunction, stmt);
TestUtils.dropUserDefinedTypeIfExists(manyParamUserDefinedType, stmt);
TestUtils.dropProcedureIfExists(manyParamProc, stmt);
Expand All @@ -118,6 +121,7 @@ public static void setupTest() throws Exception {
createProcedureZeroParams();
createOutOfOrderSproc();
createByParamNameSproc();
createConditionalProcedure();
createUserDefinedFunction();
}
}
Expand Down Expand Up @@ -1153,6 +1157,38 @@ public void testExecDocumentedSystemStoredProceduresIndexedParameters() throws S
}
}

@Test
public void testCallableStatementDefaultValues() throws SQLException {
String call0 = "{call " + conditionalSproc + " (?, ?, 1)}";
String call1 = "{call " + conditionalSproc + " (?, ?, 2)}";
int expectedValue = 5; // The sproc should return this value

try (CallableStatement cstmt = connection.prepareCall(call0)) {
cstmt.setInt(1, 1);
cstmt.setInt(2, 2);
cstmt.execute();
ResultSet rs = cstmt.getResultSet();
rs.next();
fail(TestResource.getResource("R_expectedFailPassed"));

} catch (Exception e) {
String msg = e.getMessage();
assertTrue(TestResource
.getResource("R_nullPointerExceptionFromResultSet").equalsIgnoreCase(msg)
|| msg == null);
}

try (CallableStatement cstmt = connection.prepareCall(call1)) {
cstmt.setInt(1, 1);
cstmt.setInt(2, 2);
cstmt.execute();
ResultSet rs = cstmt.getResultSet();
rs.next();

assertEquals(Integer.toString(expectedValue), rs.getString(1));
}
}

@Test
@Tag(Constants.reqExternalSetup)
@Tag(Constants.xAzureSQLDB)
Expand Down Expand Up @@ -1257,6 +1293,7 @@ public static void cleanup() throws SQLException {
TestUtils.dropProcedureIfExists(outOfOrderSproc, stmt);
TestUtils.dropProcedureIfExists(byParamNameSproc, stmt);
TestUtils.dropProcedureIfExists(currentTimeProc, stmt);
TestUtils.dropProcedureIfExists(conditionalSproc, stmt);
TestUtils.dropFunctionIfExists(userDefinedFunction, stmt);
}
}
Expand Down Expand Up @@ -1312,6 +1349,14 @@ private static void createProcedureManyParams() throws SQLException {
private static void createProcedureCurrentTime() throws SQLException {
String sql = "CREATE PROCEDURE " + currentTimeProc + " @currentTimeStamp datetime = null OUTPUT " +
"AS BEGIN SET @currentTimeStamp = CURRENT_TIMESTAMP; END";
try (Statement stmt = connection.createStatement()) {
stmt.execute(sql);
}
}

private static void createConditionalProcedure() throws SQLException {
String sql = "CREATE PROCEDURE " + conditionalSproc + " @param0 INT, @param1 INT, @maybe bigint = 2 " +
"AS BEGIN IF @maybe >= 2 BEGIN SELECT 5 END END";
try (Statement stmt = connection.createStatement()) {
stmt.execute(sql);
}
Expand Down

0 comments on commit 42c463c

Please sign in to comment.