views:

2194

answers:

3

I need to setup a JDBC connection string to SQL Server. This question is similar to the the C# ADO.Net connection question. This one is specific to JDBC connection strings.

The usual format for the JDBC string is "jdbc:sqlserver://{host}:{port}". Now, for a SQL server cluster I have a cluster name vvv\iii ({virtual server}{instance name}).

There's no problem setting up an ODBC connection through the "New Data Source to SQL Server" wizard when using the vvv\iii string as the server name. However it seems the JDBC connection string requires a specific host and port.

Is there a way to make a JDBC connect string to a SQL Server cluster?

A: 

The cluster resource has a host name and a listening port. Use jdbc:sqlserver://{virtualserver}:1433 (or the appropriate listening port if not listening on the default one).

Remus Rusanu
A: 

it turns out that you can use the "instanceName" property within the JDBC string, as documented on the Microsoft Technet page in section "Named and Multiple SQL Server Instances". What worked in my case was the following string for virtual server vvv and database instance name iii:

"jdbc:sqlserver://vvv;instanceName=iii"

pythonquick
I dislike to accept my own answer but it's the best one so far ;-)
pythonquick
A: 

Hi,

I am having the same problem when try to connect SQL Server 2005 using JDBC. I have tried your above suggested format, but No luck.

Please advise, do I have check any further setting on SQL Server 2005 side?

Thanks,

UserNew