Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jTDS connection string: connect to a MS SQL Server instance with a backslash

I am using the jTDS driver in a Java application. The database administrator told me that the SQL Server instance name is

MSSQL-DB09v1\v1

How should I write the connection URL?

I have been using something like

jdbc:jtds:sqlserver://server-name/database_name 

for some time and it works well, but don't know the right connection string when the instance name contains a backslash.

like image 637
curious1 Avatar asked Oct 24 '13 20:10

curious1


People also ask

What is jTDS connection?

The jTDS driver does support Windows authentication from non-Windows systems. Both the Microsoft SQL Server JDBC driver and the jTDS driver require no software other than the driver jar file if making a connection using SQL Server authentication.

What is SQL Server jTDS?

jTDS is an open source 100% pure Java (type 4) JDBC 3.0 driver for Microsoft SQL Server (6.5, 7, 2000, 2005, 2008 and 2012) and Sybase Adaptive Server Enterprise (10, 11, 12 and 15). jTDS is based on FreeTDS and is currently the fastest production-ready JDBC driver for SQL Server and Sybase ASE.

What is the difference between jTDS and JDBC?

One relevant difference is, that the JDBC 4.0 Implementation of the JTDS-Driver (v1. 3.1) requires at least Java 7, whereas the JDBC 4.0 Implementation of the Microsoft driver is available in Java 6. This is important if you want to use Hibernate 4.3 (relying on JDBC 4.0 API) and support Java 6.

Where do I put jTDS jar?

Copy the jtds-x.x.x.jar file to the bin/ext folder of your ReadyAPI installation.


1 Answers

Did further research and tests. Found out the correct connection URL string in this case is:

jdbc:jtds:sqlserver://server-name/database_name;instance=instance_name

In my case, the connection string is:

jdbc:jtds:sqlserver://server-name/MSSQL-DB09v1;instance=v1

See jTDS FAQs for more details

like image 127
curious1 Avatar answered Sep 28 '22 11:09

curious1