This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to know Sql version.

 
siddharth paul
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two instances of Sql server (2000 and 2005) installed.
In my application when i am coding
is showing output
Microsoft SQL Server 2000 - 8.00.2050 ......
.
i want to know how can i connect to 2005 server.
I am using Websphere studio ApplicationDeveloper as IDE and jdbc as
DataDirect ConnectJDBC type 4 driver for MS SQL Server, com.microsoft.jdbcx.sqlserver.SQLServerDataSource
.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Siddarath,
Check the port no of each instance of SQL server and make sure to use the "2005 instance" port no in the connection string.
 
siddharth paul
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the default port no. 1433 in my Websphere application studio.
Also i checked in SQL Server configuration manager TCP/IP port is 1433 for both.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Can you show the jdbc connection string , and code used to connect 2000 ? and by which way are you connecting to DB ? DriverManager or JNDI Lookup ?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't matter how many instances of SQL Server you have installed on one machine, they all listen on port 1433 by default. It is the instance name that tells SQL server which instance you want not the port number. NB: I think the SQL Server docs suggest installing 2000 and 2005 on the same machine is unsupported - I can't remember exactly, but worth a check to make sure you aren't doing something that could cause you problems. If you need both on one machine, you can use an instance of 2005 in backwards compatability mode which limits it to 2000 behaviour.

SQL Server 2005 has the major version 9, SQL Server 2000 has the major version 8. So if you use DatabaseMetaData.getMajorVersion() you will be able to find out.


i want to know how can i connect to 2005 server.

Which JDBC driver are you using? If its the MS driver you need to define the instance name as part of the server name (see the documentation). If its jTDS you need to pass a property called "instance".
 
siddharth paul
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bala
I am doing JNDI lookup with jdbc v4 "DataDirect ConnectJDBC type 4 driver for MS SQL Server" in websphere.

Paul
thanks for you tips.
If its the MS driver you need to define the instance name as part of the server name.

How to do this.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to if you are not using the Microsoft driver. I'm afraid I don't know how to configure the DataDirect driver. But they should have documentation you can use?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic