Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Connecting to Sql Server 2005 with JDBC

Author  Topic 

eric_ht
Starting Member

37 Posts

Posted - 2008-12-02 : 20:21:51
We have two instances of sql server 2005 running on the same box. For example one is MYSERVER the other is named MYSERVER\TWO.

The MYSERVER\TWO is a development instance. In my C#.net connection strings I can specify MYSERVER\TWO and it connects fine. But JDBC throws an "unknown server host name" error. JDBC will connect fine to the MYSERVER instance.

Is it the fact that there is a backslash in the name or do I need to specify an instance in the jdbc connection string such as server = MYSERVER, Instance=MYSERVER/TWO? I'm not a java programmer so I haven't been able to get this part tested yet. I tried doubling the backslahes but that didn't work either. Or is it some other problem?

Thanks

eric_ht
Starting Member

37 Posts

Posted - 2008-12-04 : 07:46:16
Found the solution. We are using a Sourceforge jdbc driver instead of the Microsoft driver. The Sourceforge driver requires the Server Name and Instance entered seperately like this: //MYSERVER:1433;instance=TWO;database=mydatabase;user=someuser;password=somepassword

Whereas the Microsoft driver will accept this:
//MYSERVER\TWO:1433;database=mydatabase;user=someuser;password=somepassword
Go to Top of Page
   

- Advertisement -