Microsoft Jdbc Driver 4 0 For Sql Server For Mac

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 192.168.99.132 and Windows Firewall is turned off. I downloaded the Microsoft SQL Server 2012 JDBC driver 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 guest machine names of either 'winny', 'localhost', or '192.168.99.132' (JDBC URLs like jdbc:sqlserver://winny SQLEXPRESS:1433;databaseName=vha). However, when I try to connect to SQL Server from Squirrel running on the Mac host, 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 the JDBC URL jdbc:jtds:sqlserver://192.168.99.132:1433/vha. Any ideas why the Microsoft driver fails but jTDS succeeds from a remote host?

The only piece of infomration missing from the jTDS URL that's in the Microsoft one is the instance name ('SQLEXPRESS'). And yes, I've tried the Microsoft URL with and without the instance name. In theory you also need the instance name in the jTDS connection string (e.g.

Appending ';instance=SQLEXPRESS') - but I am not familair with jTDS and I might be wrong, but if you are not setting that and you are connecting then perhaps you are connecting to something else? You showed your jTDS connection string above with the IP address and the Microsoft one with the server name 'winny' (jdbc:sqlserver://winny SQLEXPRESS:1433;databaseName=vha) - have you tried the IP address? (jdbc:sqlserver://192.168.99.132 SQLEXPRESS:1433;databaseName=vha) Things I usually try:. Verify the port - can you telnet to localhost port 1433 on the host machine. Verify the network - make sure the host responds to ping - can you ping it by name from the client? By IP Address?.

Verify port 1433 is open - can you telnet from the client to the host on port 1433? Because you can connect from the Mac client with jTDS you should be able to do all three of these already but it would be worth double checking. You could also try hardcoding the port 1433 (change it from blank) on the server - maybe another instance of SQL exists? See also Here are some steps I usually go through, maybe this will help:. (Server) Open SSMS, right-click the SQL Server, Properties; verify that Allow Remote Connections is checked.

If not, check and restart SQL Server. (Server) Open SQL Server Configuration Manager (Start - SQL Server - Configuration Tools). Verify that TCP/IP is Enabled. For default instance verify that static port 1433 is set (Note: a named instance will have a backslash, e.g.

Something like MYSQLSERVER MYINSTANCE, whereas a default instance is identified with just the server name.). For named instance choose another static port, e.g. 1434+, and set it as the static port. Only one per instance – do not re-use them on the same machine.

Restart SQL Server service. (Server) Verify that what you did worked so far; on SQL Server machine:. Open CMD prompt, 'telnet localhost 1433' (change 1433 to other port number as appropriate).

If you get a blank screen that is 'hung', it worked!. If you get an error, it did not work.

Microsoft Jdbc Driver 4.0 For Sql Server For Mac

Go back to square 1. Try the same thing but using the machine name instead of localhost. (Server) Configure Windows Firewall to add an exception to TCP port 1433 (or whichever port you chose in step 2).

(Server) If using named instances, add another exception to UDP port 1433 as well (for the SQL Browser service, which uses UDP not TCP – also note SQL Browser Service ALWAYS uses port 1433 even if you chose a different TCP port for your instance in step 2). (Client) Verify from another machine on the same network. Open CMD prompt, 'ping ' – if you get responses, the machines can see each other. Even if you do not get a response, try the next step – Windows 7 for example may default to NOT reply to echo requests (ping). Open CMD prompt, 'telnet 1433' (change 1433 to other port number as appropriate).

For

If you get a blank screen that is 'hung', it worked!. If you get an error, it did not work. Go back to square 1. (Client) Now try and connect to the SQL Server from another application like Excel. (Client) See also for other errors.

Step 1: Download jtds.jar from Step 2: Add the jar into eclipse or any IDE. Step 3: String driver='net.sourceforge.jtds.jdbc.Driver'; Class.forName(driver).newInstance; String connString='jdbc:jtds:sqlserver://127.0.0.1:1433/databasename;encrypt=false;user=sa;password=yourpassword;integratedSecurity=true;instance=SQLEXPRESS;'; String username='sa'; String password='yourpassword'; OR String connString='jdbc:jtds:sqlserver://192.168.1.198:1433/databasename;encrypt=false;user=sa;password=yourpassword;'; String username='sa'; String password='yourpassword'.

Comments are closed.