Skip to content

Commit

Permalink
Merge branch 'microsoft:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffery-Wasty authored Sep 20, 2024
2 parents c482c60 + 3be298f commit 8374ca4
Show file tree
Hide file tree
Showing 43 changed files with 1,113 additions and 2,163 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@ All notable changes to this project will be documented in this file.

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

## [12.8.0] Stable Release
### Fixed issues
- Fixed regression with specifying argument names in callable statement syntax [#2480](https://github.com/microsoft/mssql-jdbc/pull/2480)

## [12.7.1] Preview Release
### Added
- Added JDK 22 support [#2414](https://github.com/microsoft/mssql-jdbc/pull/2414)
- Added credential caching for Managed Identity Credential and Default Azure Credential [#2415](https://github.com/microsoft/mssql-jdbc/pull/2415)
- Added Caching SQLServerBulkCopy object for batch insert [#2435](https://github.com/microsoft/mssql-jdbc/pull/2435)
- Added connection level bulk copy metadata caching [#2464](https://github.com/microsoft/mssql-jdbc/pull/2464)
- Added logging to token caching [#2468](https://github.com/microsoft/mssql-jdbc/pull/2468)

### Changed
- Bump org.bouncycastle:bcprov-jdk18on from 1.77 to 1.78 [#2403](https://github.com/microsoft/mssql-jdbc/pull/2403)
- Enum SQLServerSortOrder is now public [#2405](https://github.com/microsoft/mssql-jdbc/pull/2405)
- Bump com.azure:azure-identity from 1.12.1 to 1.12.2 [#2447](https://github.com/microsoft/mssql-jdbc/pull/2447)
- Bump com.microsoft.azure:msal4j from 1.15.0 to 1.15.1 [#2448](https://github.com/microsoft/mssql-jdbc/pull/2448)

### Fixed issues
- Execute stored procedures directly for RPC calls [#2410](https://github.com/microsoft/mssql-jdbc/pull/2410)
- Fix SqlAuthenticationToken constructor accepting unix epoch [#2425](https://github.com/microsoft/mssql-jdbc/pull/2425)
- TokenCredential class shouldn't be required [#2441](https://github.com/microsoft/mssql-jdbc/pull/2441)
- Fixed timestamp string conversion error for CallableStatements [#2449](https://github.com/microsoft/mssql-jdbc/pull/2449)
- Fixed CallableStatements default value regression [#2452](https://github.com/microsoft/mssql-jdbc/pull/2452)
- Fixed parentheses parsing for stored procedure names and function names [#2467](https://github.com/microsoft/mssql-jdbc/pull/2467)

## [12.7.0] Preview Release
### Added
- Server Message Handler and SQLException Chaining [#2251](https://github.com/microsoft/mssql-jdbc/pull/2251)
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,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.0.jre11</version>
<version>12.8.1.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 @@ -94,7 +94,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.0.jre11</version>
<version>12.8.1.jre11</version>
</dependency>
```

Expand Down Expand Up @@ -129,14 +129,14 @@ 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.0.jre11</version>
<version>12.8.1.jre11</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.3.3</version>
<version>1.12.2</version>
</dependency>

```
Expand All @@ -147,20 +147,20 @@ 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.0.jre11</version>
<version>12.8.1.jre11</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.3.3</version>
<version>1.12.2</version>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-keys</artifactId>
<version>4.2.8</version>
<version>4.7.3</version>
</dependency>
```

Expand All @@ -174,13 +174,13 @@ 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.0.jre11</version>
<version>12.8.1.jre11</version>
</dependency>

<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.9.2</version>
<version>4.9.3</version>
</dependency>
```

Expand Down Expand Up @@ -214,7 +214,7 @@ Preview releases happen approximately monthly between stable releases. This give
You can see what is going into a future release by monitoring [Milestones](https://github.com/Microsoft/mssql-jdbc/milestones) in the repository.

### Version conventions
Starting with 6.0, stable versions have an even minor version. For example, 6.0, 6.2, 6.4, 7.0, 7.2, 7.4, 8.2, 8.4, 9.2, 9.4, 10.2, 11.2, 12.2, 12.4, 12.6. Preview versions have an odd minor version. For example, 6.1, 6.3, 6.5, 7.1, 7.3, 8.1, 9.1, 10.1, 11.1, 12.1, 12.3, 12.5, and so on.
Starting with 6.0, stable versions have an even minor version. For example, 6.0, 6.2, 6.4, 7.0, 7.2, 7.4, 8.2, 8.4, 9.2, 9.4, 10.2, 11.2, 12.2, 12.4, 12.6, 12.8. Preview versions have an odd minor version. For example, 6.1, 6.3, 6.5, 7.1, 7.3, 8.1, 9.1, 10.1, 11.1, 12.1, 12.3, 12.5, 12.7, 12.9, and so on.

## Contributors
Special thanks to everyone who has contributed to the project.
Expand Down
30 changes: 15 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

apply plugin: 'java'

version = '12.7.1-SNAPSHOT'
version = '12.9.0'
def releaseExt = '-preview'
def jreVersion = ""
def testOutputDir = file("build/classes/java/test")
Expand Down Expand Up @@ -46,7 +46,7 @@ if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile
targetCompatibility = 22
}

if (!hasProperty('buildProfile') || (hasProperty('buildProfile') && buildProfile == "jre21")) {
if (hasProperty('buildProfile') && buildProfile == "jre21") {

jreVersion = "jre21"
excludedFile = 'com/microsoft/sqlserver/jdbc/SQLServerJdbc42.java'
Expand Down Expand Up @@ -143,29 +143,29 @@ repositories {
dependencies {
implementation 'org.osgi:org.osgi.core:6.0.0',
'org.osgi:org.osgi.service.jdbc:1.1.0'
compileOnly 'com.azure:azure-security-keyvault-keys:4.5.2',
'com.azure:azure-identity:1.7.0',
compileOnly 'com.azure:azure-security-keyvault-keys:4.7.3',
'com.azure:azure-identity:1.12.2',
'org.antlr:antlr4-runtime:4.9.3',
'com.google.code.gson:gson:2.9.0',
'org.bouncycastle:bcprov-jdk15on:1.70',
'org.bouncycastle:bcpkix-jdk15on:1.70'
'com.google.code.gson:gson:2.10.1',
'org.bouncycastle:bcprov-jdk18on:1.78',
'org.bouncycastle:bcpkix-jdk18on:1.78'
testImplementation 'org.junit.platform:junit-platform-console:1.5.2',
'org.junit.platform:junit-platform-commons:1.5.2',
'org.junit.platform:junit-platform-engine:1.5.2',
'org.junit.platform:junit-platform-launcher:1.5.2',
'org.junit.platform:junit-platform-runner:1.5.2',
'org.junit.platform:junit-platform-surefire-provider:1.3.2',
'org.junit.jupiter:junit-jupiter-api:5.6.0',
'org.junit.jupiter:junit-jupiter-engine:5.6.0',
'org.junit.jupiter:junit-jupiter-params:5.6.0',
'org.junit.jupiter:junit-jupiter-api:5.8.2',
'org.junit.jupiter:junit-jupiter-engine:5.8.2',
'org.junit.jupiter:junit-jupiter-params:5.8.2',
'com.zaxxer:HikariCP:3.4.2',
'org.apache.commons:commons-dbcp2:2.7.0',
'org.slf4j:slf4j-nop:1.7.30',
'org.antlr:antlr4-runtime:4.9.3',
'org.eclipse.gemini.blueprint:gemini-blueprint-mock:2.1.0.RELEASE',
'com.google.code.gson:gson:2.9.0',
'org.bouncycastle:bcprov-jdk15on:1.70',
'com.azure:azure-security-keyvault-keys:4.5.2',
'com.azure:azure-identity:1.7.0',
'com.h2database:h2:2.1.210'
'com.google.code.gson:gson:2.10.1',
'org.bouncycastle:bcprov-jdk18on:1.78',
'com.azure:azure-security-keyvault-keys:4.7.3',
'com.azure:azure-identity:1.12.2',
'com.h2database:h2:2.2.220'
}
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.7.1 FOR SQL SERVER
MICROSOFT JDBC DRIVER 12.9.0 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
29 changes: 25 additions & 4 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.7.1-SNAPSHOT</version>
<version>12.9.0</version>
<packaging>jar</packaging>
<name>Microsoft JDBC Driver for SQL Server</name>
<description>
Expand Down Expand Up @@ -225,6 +225,30 @@
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<url>https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/mssql-jdbc/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://sqlclientdrivers.pkgs.visualstudio.com/public/_packaging/mssql-jdbc/maven/v1</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<profiles>
<profile>
<id>jre8</id>
Expand Down Expand Up @@ -347,9 +371,6 @@
</profile>
<profile>
<id>jre21</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<finalName>${project.artifactId}-${project.version}.jre21${releaseExt}</finalName>
<plugins>
Expand Down
44 changes: 7 additions & 37 deletions src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ static final String getEncryptionLevel(int level) {
final static int COLINFO_STATUS_DIFFERENT_NAME = 0x20;

final static int MAX_FRACTIONAL_SECONDS_SCALE = 7;
final static int DEFAULT_FRACTIONAL_SECONDS_SCALE = 3;

final static Timestamp MAX_TIMESTAMP = Timestamp.valueOf("2079-06-06 23:59:59");
final static Timestamp MIN_TIMESTAMP = Timestamp.valueOf("1900-01-01 00:00:00");
Expand Down Expand Up @@ -4854,7 +4853,7 @@ void writeVMaxHeader(long headerLength, boolean isNull, SQLCollation collation)
* Utility for internal writeRPCString calls
*/
void writeRPCStringUnicode(String sValue) throws SQLServerException {
writeRPCStringUnicode(null, sValue, false, null, false);
writeRPCStringUnicode(null, sValue, false, null);
}

/**
Expand All @@ -4869,8 +4868,8 @@ void writeRPCStringUnicode(String sValue) throws SQLServerException {
* @param collation
* the collation of the data value
*/
void writeRPCStringUnicode(String sName, String sValue, boolean bOut, SQLCollation collation,
boolean isNonPLP) throws SQLServerException {
void writeRPCStringUnicode(String sName, String sValue, boolean bOut,
SQLCollation collation) throws SQLServerException {
boolean bValueNull = (sValue == null);
int nValueLen = bValueNull ? 0 : (2 * sValue.length());
// Textual RPC requires a collation. If none is provided, as is the case when
Expand All @@ -4882,7 +4881,7 @@ void writeRPCStringUnicode(String sName, String sValue, boolean bOut, SQLCollati
* Use PLP encoding if either OUT params were specified or if the user query exceeds
* DataTypes.SHORT_VARTYPE_MAX_BYTES
*/
if ((nValueLen > DataTypes.SHORT_VARTYPE_MAX_BYTES || bOut) && !isNonPLP) {
if (nValueLen > DataTypes.SHORT_VARTYPE_MAX_BYTES || bOut) {
writeRPCNameValType(sName, bOut, TDSType.NVARCHAR);

writeVMaxHeader(nValueLen, // Length
Expand Down Expand Up @@ -5633,8 +5632,8 @@ void writeCryptoMetaData() throws SQLServerException {
writeByte(cryptoMeta.normalizationRuleVersion);
}

void writeRPCByteArray(String sName, byte[] bValue, boolean bOut, JDBCType jdbcType, SQLCollation collation,
boolean isNonPLP) throws SQLServerException {
void writeRPCByteArray(String sName, byte[] bValue, boolean bOut, JDBCType jdbcType,
SQLCollation collation) throws SQLServerException {
boolean bValueNull = (bValue == null);
int nValueLen = bValueNull ? 0 : bValue.length;
boolean isShortValue = (nValueLen <= DataTypes.SHORT_VARTYPE_MAX_BYTES);
Expand Down Expand Up @@ -5680,7 +5679,7 @@ void writeRPCByteArray(String sName, byte[] bValue, boolean bOut, JDBCType jdbcT

writeRPCNameValType(sName, bOut, tdsType);

if (usePLP && !isNonPLP) {
if (usePLP) {
writeVMaxHeader(nValueLen, bValueNull, collation);

// Send the data.
Expand Down Expand Up @@ -7059,35 +7058,6 @@ final short peekStatusFlag() {
return 0;
}

final int peekReturnValueStatus() throws SQLServerException {
// Ensure that we have a packet to read from.
if (!ensurePayload()) {
throwInvalidTDS();
}

// In order to parse the 'status' value, we need to skip over the following properties in the TDS packet
// payload: TDS token type (1 byte value), ordinal/length (2 byte value), parameter name length value (1 byte value) and
// the number of bytes that make the parameter name (need to be calculated).
//
// 'offset' starts at 4 because tdsTokenType + ordinal/length + parameter name length value is 4 bytes. So, we
// skip 4 bytes immediateley.
int offset = 4;
int paramNameLength = currentPacket.payload[payloadOffset + 3];

// Check if parameter name is set. If it's set, it should be > 0. In which case, we add the
// additional bytes to skip.
if (paramNameLength > 0) {
// Each character in unicode is 2 bytes
offset += 2 * paramNameLength;
}

if (payloadOffset + offset <= currentPacket.payloadLength) {
return currentPacket.payload[payloadOffset + offset] & 0xFF;
}

return -1;
}

final int readUnsignedByte() throws SQLServerException {
// Ensure that we have a packet to read from.
if (!ensurePayload())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,4 +532,19 @@ CallableStatement prepareCall(String sql, int nType, int nConcur, int nHold,
* @return flag for using Bulk Copy API for batch insert operations.
*/
boolean getUseBulkCopyForBatchInsert();

/**
* Returns value of 'cacheBulkCopyMetadata' from Connection String.
*
* @param cacheBulkCopyMetadata
* indicates whether the driver should use connection level caching of metadata for bulk copy
*/
void setcacheBulkCopyMetadata(boolean cacheBulkCopyMetadata);

/**
* Sets the value for 'cacheBulkCopyMetadata' property
*
* @return cacheBulkCopyMetadata boolean value
*/
boolean getcacheBulkCopyMetadata();
}
Loading

0 comments on commit 8374ca4

Please sign in to comment.