on 07-03-2007 10:51 AM
I want to get data from a Microsoft SQL Server via JDBC. We have such a scenario and till now it works fine. Now we have a second instance at the sql server and we want to connect to this instance. I've found the following MSD article:
http://msdn2.microsoft.com/en-us/library/ms378428.aspx
<b>SQL Server 2000 and SQL Server 2005 allow for the installation of multiple database instances per server. Each instance is identified by a specific name. To connect to a named instance of SQL Server, you can either specify the port number of the named instance (preferred), or you can specify the instance name as a JDBC URL property or a datasource property. If no instance name or port number property is specified, a connection to the default instance is created. See the following examples:
To use a port number, do the following:
jdbc:sqlserver://localhost:1433;integratedSecurity=true;<more properties as required>;
To use a JDBC URL property, do the following:
jdbc:sqlserver://localhost;instanceName=instance1;integratedSecurity=true;<more properties as required>;</b>
Because the named instance has no explicit port I've tried to use the second one but this doesn't work. I've tried all possible combinations of these parameters but either I get an error or my adapter connects to the first instance
Any idea how I can connect to the second named instance?
Technically, as mentioned by MS, using name of the database instance must be working. Please verify there is no case differences in the url used and the instance name as well..
VJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have also a SQL server 2000 instance at the same server. Yesterday I have spoken with the sql server admin and he told me that he has disconnect the sql server 2000 databases whatever this means. 😄
Now all works fine. Thank you for your help
BTW I use the following connection string:
jdbc:sqlserver://my_db_server;instanceName=my_instance_name;DatabaseName=my_db_name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you could connect to the instance via url
Example
SQL-Server-Name: PC1
Instance: Inst1
URL: jdbc:sqlserver://PC1\Inst1:<port>;databaseName=< db_name>
I tried it and it works fine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.