Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push 6.5.1-preview into master #671

Merged
merged 27 commits into from
Apr 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
75efddb
ADD: Testcase to show broken java.sql.Time support
rPraml Nov 20, 2017
7581d85
added tests for TVP and date/time objects
rPraml Nov 21, 2017
f894dab
updated connection string
rPraml Nov 21, 2017
d064602
Merge pull request #1 from Microsoft/dev
rPraml Nov 21, 2017
ff16f28
Merge pull request #30 from Microsoft/dev
rene-ye Mar 9, 2018
16c6aa9
update pom file for 6.5.1
rene-ye Mar 9, 2018
f6d7c70
Merge pull request #651 from rene-ye/651SNAPSHOT
rene-ye Mar 9, 2018
95d888d
Removing unused imports
peterbae Mar 10, 2018
4a99502
Removing AKV from pom description (#653)
ulvii Mar 12, 2018
19dc6ed
Merge branch 'dev' into bug/testcase-for-time-support
peterbae Mar 12, 2018
2d740b7
Replace deprecated methods and clean up the connection
peterbae Mar 12, 2018
d970d77
Merge pull request #558 from FOCONIS/bug/testcase-for-time-support
peterbae Mar 12, 2018
b97baa1
SQLServerResultSetMetaData::getColumnType for spatial datatypes shoul…
peterbae Mar 13, 2018
daba0da
Merge pull request #652 from peterbae/dev
peterbae Mar 13, 2018
e0fbbdd
explicitly give column name to work around sql server 2008 problem
peterbae Mar 13, 2018
f826fa7
Adding release roadmap and standards info
David-Engel Mar 16, 2018
3a8c146
Merge pull request #660 from Microsoft/David-Engel-patch-1
cheenamalhotra Mar 17, 2018
2039522
Small tweak to the README
David-Engel Mar 22, 2018
5310f03
create a constant for typeInfo.getSSType
peterbae Mar 23, 2018
017a09d
use existing string instead of creating a new string
peterbae Mar 23, 2018
8ad8252
Merge branch 'dev' into github-655
peterbae Mar 23, 2018
c1aa43b
Merge pull request #657 from peterbae/github-655
peterbae Mar 23, 2018
92af829
Fix for the issue when using setMaxRows() with SHOWPLAN ON (#666)
ulvii Apr 5, 2018
4ca55d9
Fix for uncaught/unhandled exception (#664)
rene-ye Apr 5, 2018
07e391e
Use Socket instead of SocketChannel when multiSubnetFailover=true (#662)
ulvii Apr 5, 2018
501f2b8
Removed Exception Test (#669)
rene-ye Apr 6, 2018
03c6617
Changes in preparation for 6.5.1 preview release (#670)
rene-ye Apr 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file.

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

## [6.5.1] Preview Release
### Added
- Test cases for Date, Time, and Datetime2 data types. [#558](https://github.com/Microsoft/mssql-jdbc/pull/558)

### Fixed Issues
- Fixed an issue where ResultSetMetadata returned incorrect columnType for Geometry and Geography data types [#657](https://github.com/Microsoft/mssql-jdbc/pull/657)
- Fixed server side CPU Affinity problems caused by uneven connection distribution across NUMA Nodes when multiSubnetFailover is true [#662](https://github.com/Microsoft/mssql-jdbc/pull/662)
- Fixed an issue where Driver wasn't parsing TDS Packets completely to capture exceptions raised inside executed stored procedures [#664](https://github.com/Microsoft/mssql-jdbc/pull/664)
- Fixed an issue where driver throws exception when using setMaxRows() followed by query execution when SHOWPLAN_TEXT is ON [#666](https://github.com/Microsoft/mssql-jdbc/pull/666)

### Changed
- Removed unused imports which forced users to import the ADAL4J library [#652](https://github.com/Microsoft/mssql-jdbc/pull/652)

## [6.5.0] Preview Release
### Added
- Support for spatial datatypes [#642](https://github.com/Microsoft/mssql-jdbc/pull/642)
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ What's coming next? We will look into adding a more comprehensive set of tests,
* An instance of SQL Server or Azure SQL Database that you can connect to.

### Build the JAR files
Maven builds automatically trigger a set of verification tests to run. For these tests to pass, you will first need to add an environment variable in your system called `mssql_jdbc_test_connection_properties` to provide the [correct connection properties](https://msdn.microsoft.com/en-us/library/ms378428(v=sql.110).aspx) for your SQL Server or Azure SQL Database instance.
Maven builds automatically trigger a set of verification tests to run. For these tests to pass, you will first need to add an environment variable in your system called `mssql_jdbc_test_connection_properties` to provide the [correct connection properties](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url) for your SQL Server or Azure SQL Database instance.

To build the jar files, you must use Java 9 with Maven. You can choose to build a JDBC 4.3 compliant jar file (for use with JRE 9) and/or a JDBC 4.2 compliant jar file (for use with JRE 8).

Expand All @@ -64,13 +64,13 @@ To build the jar files, you must use Java 9 with Maven. You can choose to build
### Documentation
API reference documentation is available in [Javadocs](https://aka.ms/jdbcjavadocs).

This driver is documented on [Microsoft's Documentation web site](https://msdn.microsoft.com/en-us/library/mt720657).
This driver is documented on [Microsoft's Documentation web site](https://docs.microsoft.com/en-us/sql/connect/jdbc/getting-started-with-the-jdbc-driver).

### Sample Code
For samples, please see the src\sample directory.

### Download the DLLs
For some features (e.g. Integrated Authentication and Distributed Transactions), you may need to use the `sqljdbc_xa` and `sqljdbc_auth` DLLs. They can be downloaded from the [Microsoft Download Center](https://go.microsoft.com/fwlink/?linkid=852460)
For some features (e.g. Integrated Authentication and Distributed Transactions), you may need to use the `sqljdbc_xa` and `sqljdbc_auth` DLLs. They can be downloaded from the [Microsoft Download Center](https://go.microsoft.com/fwlink/?linkid=868287)

### Download the driver
Don't want to compile anything?
Expand All @@ -83,14 +83,14 @@ We're now on the Maven Central Repository. Add the following to your POM file to
<version>6.4.0.jre9</version>
</dependency>
```
The driver can be downloaded from the [Microsoft Download Center](https://go.microsoft.com/fwlink/?linkid=852460).
The driver can be downloaded from the [Microsoft Download Center](https://go.microsoft.com/fwlink/?linkid=868287).

To get the latest preview version of the driver, add the following to your POM file:
```xml
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.5.0.jre9-preview</version>
<version>6.5.1.jre9-preview</version>
</dependency>
```

Expand Down Expand Up @@ -120,7 +120,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>6.5.0.jre9-preview</version>
<version>6.5.1.jre9-preview</version>
<scope>compile</scope>
</dependency>

Expand All @@ -136,7 +136,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>6.5.0.jre9-preview</version>
<version>6.5.1.jre9-preview</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -176,6 +176,16 @@ Thank you!
### Reporting security issues and security bugs
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) [secure@microsoft.com](mailto:secure@microsoft.com). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/ff852094.aspx).

## Release roadmap and standards
Our goal is to release regular updates which improve the driver and bring new features to users. Stable, production quality releases happen twice a year, targeting the first and third quarters of the calendar year. They are tested against a comprehensive matrix of supported operating systems, Java versions, and SQL Server versions. Stable releases are accompanied by additional localized packages, which are available on the Microsoft website.

Preview releases happen approximately monthly between stable releases. This gives users an opportunity to try out new features and provide feedback on them before they go into stable releases. Preview releases also include frequent bug fixes for customers to verify without having to wait for a stable release. Preview releases are only available in English. While they are tested, preview releases do not necessarily go through the same rigorous, full test matrix and review process as stable releases.

You can see what is going into a future release by monitoring [Milestones](https://github.com/Microsoft/mssql-jdbc/milestones) in the repository.

### Versioning convention
Starting with 6.0, stable versions have an even minor version. For example, 6.0, 6.2, 6.4. Preview versions have an odd minor version. For example, 6.1, 6.3, 6.5.

## Contributors
Special thanks to everyone who has contributed to the project.

Expand Down
4 changes: 1 addition & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@

<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.5.0.${jreVersion}-preview</version>
<version>6.5.1.${jreVersion}-preview</version>
<packaging>jar</packaging>

<name>Microsoft JDBC Driver for SQL Server</name>
<description>
Microsoft JDBC Driver for SQL Server.
The Azure Key Vault feature in Microsoft JDBC Driver for SQL Server depends on
Azure SDK for JAVA and Azure Active Directory Library For Java.
</description>
<url>https://github.com/Microsoft/mssql-jdbc</url>

Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/Geography.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Locale;

public class Geography extends SQLServerSpatialDatatype {

Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/Geometry.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Locale;

public class Geometry extends SQLServerSpatialDatatype {

Expand Down
27 changes: 13 additions & 14 deletions src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2337,8 +2337,8 @@ else if (!useTnir) {
findSocketUsingJavaNIO(inetAddrs, portNumber, timeoutInMilliSeconds);
}
else {
LinkedList<Inet4Address> inet4Addrs = new LinkedList<>();
LinkedList<Inet6Address> inet6Addrs = new LinkedList<>();
LinkedList<InetAddress> inet4Addrs = new LinkedList<>();
LinkedList<InetAddress> inet6Addrs = new LinkedList<>();

for (InetAddress inetAddr : inetAddrs) {
if (inetAddr instanceof Inet4Address) {
Expand All @@ -2360,11 +2360,10 @@ else if (!useTnir) {

if (!inet4Addrs.isEmpty()) {
if (logger.isLoggable(Level.FINER)) {
logger.finer(this.toString() + "Using Java NIO with timeout:" + timeoutForEachIPAddressType);
logger.finer(this.toString() + "Using Java Threading with timeout:" + timeoutForEachIPAddressType);
}

// inet4Addrs.toArray(new InetAddress[0]) is java style of converting a linked list to an array of reqd size
findSocketUsingJavaNIO(inet4Addrs.toArray(new InetAddress[0]), portNumber, timeoutForEachIPAddressType);
findSocketUsingThreading(inet4Addrs, portNumber, timeoutForEachIPAddressType);
}

if (!result.equals(Result.SUCCESS)) {
Expand Down Expand Up @@ -2590,16 +2589,12 @@ private void findSocketUsingJavaNIO(InetAddress[] inetAddrs,

// if a channel was selected, make the necessary updates
if (selectedChannel != null) {
// the selectedChannel has the address that is connected successfully
// convert it to a java.net.Socket object with the address
SocketAddress iadd = selectedChannel.getRemoteAddress();
selectedSocket = new Socket();
selectedSocket.connect(iadd);
// Note that this must be done after selector is closed. Otherwise,
// we would get an illegalBlockingMode exception at run time.
selectedChannel.configureBlocking(true);
selectedSocket = selectedChannel.socket();

result = Result.SUCCESS;

// close the channel since it is not used anymore
selectedChannel.close();
}
}

Expand Down Expand Up @@ -2638,7 +2633,7 @@ private Socket getConnectedSocket(InetSocketAddress addr,
return selectedSocket;
}

private void findSocketUsingThreading(LinkedList<Inet6Address> inetAddrs,
private void findSocketUsingThreading(LinkedList<InetAddress> inetAddrs,
int portNumber,
int timeoutInMilliSeconds) throws IOException, InterruptedException {
assert timeoutInMilliSeconds != 0 : "The timeout cannot be zero";
Expand Down Expand Up @@ -2722,6 +2717,10 @@ private void findSocketUsingThreading(LinkedList<Inet6Address> inetAddrs,
}
}
}

if (selectedSocket != null) {
result = Result.SUCCESS;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
final class SQLJdbcVersion {
static final int major = 6;
static final int minor = 5;
static final int patch = 0;
static final int patch = 1;
static final int build = 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6334,9 +6334,20 @@ boolean onNBCRow(TDSReader tdsReader) throws SQLServerException {
boolean onDone(TDSReader tdsReader) throws SQLServerException {
ensureStartMark();

// Consume the done token
int token = tdsReader.peekTokenType();
StreamDone doneToken = new StreamDone();
doneToken.setFromTDS(tdsReader);

int packetType = tdsReader.peekTokenType();
if (-1 != packetType && TDS.TDS_DONEINPROC == token) {
switch (packetType) {
case TDS.TDS_ENV_CHG:
case TDS.TDS_ERR:
return true;
default:
break;
}
}

// Done with all the rows in this fetch buffer and done with parsing
// unless it's a server cursor, in which case there is a RETSTAT and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,21 @@ public int getColumnType(int column) throws SQLServerException {
}

JDBCType jdbcType = typeInfo.getSSType().getJDBCType();
SSType sqlType = typeInfo.getSSType();
// in bulkcopy for instance, we need to return the real jdbc type which is sql variant and not the default Char one.
if ( SSType.SQL_VARIANT == typeInfo.getSSType()){
if ( SSType.SQL_VARIANT == sqlType){
jdbcType = JDBCType.SQL_VARIANT;
}
if (SSType.UDT == sqlType) {
if (typeInfo.getSSTypeName().equalsIgnoreCase(SSType.GEOMETRY.name())) {
jdbcType = JDBCType.GEOMETRY;
}
if (typeInfo.getSSTypeName().equalsIgnoreCase(SSType.GEOGRAPHY.name())) {
jdbcType = JDBCType.GEOGRAPHY;
}
}
int r = jdbcType.asJavaSqlType();
if (con.isKatmaiOrLater()) {
SSType sqlType = typeInfo.getSSType();

switch (sqlType) {
case VARCHARMAX:
r = SSType.VARCHAR.getJDBCType().asJavaSqlType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@

import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import com.sun.mail.imap.protocol.INTERNALDATE;

abstract class SQLServerSpatialDatatype {

/**WKT = Well-Known-Text, WKB = Well-Knwon-Binary */
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/com/microsoft/sqlserver/jdbc/tdsparser.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ class TDSTokenHandler {

private StreamError databaseError;

/** TDS protocol diagnostics logger */
private static Logger logger = Logger.getLogger("com.microsoft.sqlserver.jdbc.internals.TDS.TOKEN");

final StreamError getDatabaseError() {
return databaseError;
}
Expand Down Expand Up @@ -227,7 +230,10 @@ boolean onOrder(TDSReader tdsReader) throws SQLServerException {
}

boolean onColMetaData(TDSReader tdsReader) throws SQLServerException {
TDSParser.throwUnexpectedTokenException(tdsReader, logContext);
//SHOWPLAN might be ON, instead of throwing an exception, ignore the column meta data
if (logger.isLoggable(Level.SEVERE))
logger.severe(tdsReader.toString() + ": " + logContext + ": Encountered "
+ TDS.getTokenName(tdsReader.peekTokenType()) + ". SHOWPLAN is ON, ignoring.");
return false;
}

Expand Down
Loading