Microsoft JDBC driver fails, but jTDS driver succeeds - by matthewadams12

Status : 


Sign in
to vote
ID 776705 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 1/16/2013 7:23:10 AM
Access Restriction Public


The Microsoft JDBC driver is failing to connect to a SQL Server 2012 Express database via TCP/IP, but the jTDS driver is succeeding against the exact same database.

See forum post for discussion.  For your convenience, here's a copy as well:

This is weird. I'm on a Mac OS X 10.7.5 64-bit host running VirtualBox 4.2.6. I've got a Windows 7 SP1 guest (64-bit) with bridged networking running Microsoft SQL Server Express 2012. I configured SQL Server to use TCP/IP on port 1433, not dynamic ports (setting is blank, not 0). The Windows 7 guest has IPv4 address and Windows Firewall is turned off.

I downloaded the Microsoft SQL Server 2012 JDBC driver (sqljdbc4.jar) along with Squirrel SQL client 3.4.0 for both Windows and Mac. When I run Squirrel on the Windows 7 guest OS itself, I can connect to SQL Server just fine via the Microsoft JDBC driver using the machine names of either "winny", "localhost", or "" (JDBC URLs like jdbc:sqlserver://winny\SQLEXPRESS:1433;databaseName=vha). However, when I try to connect to SQL Server from Squirrel on the Mac via the IP address (can't resolve "winny"), I get an exception (see stack trace below).

Here's the weird part. If, from the Mac host, I use the jTDS SQL Server driver (version 1.2.7 because I'm using JDK6, so can't use jTDS 1.3.0 -- that version is JDK7 only), I connect right away with both of the JDBC URLs jdbc:jtds:sqlserver://;instance=SQLEXPRESS or jdbc:jtds:sqlserver://

Any ideas why the Microsoft driver fails but jTDS succeeds from a remote host?  And yes, I've tried the Microsoft URL with and without the instance name.

Java version on the Mac host is:

java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
Java version on the Windows 7 guest is:

java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)

Stack trace when connecting from Mac host to Windows 7 guest is in "Actual Results" of this bug report.
Sign in to post a comment.