aspose file tools*
The moose likes JDBC and the fly likes Need to know Sql version. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Need to know Sql version." Watch "Need to know Sql version." New topic
Author

Need to know Sql version.

siddharth paul
Greenhorn

Joined: Apr 30, 2008
Posts: 20
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

Joined: Jan 01, 2009
Posts: 874

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

Joined: Apr 30, 2008
Posts: 20
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

Joined: Jan 01, 2009
Posts: 874



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

Joined: Apr 14, 2004
Posts: 10336

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".


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
siddharth paul
Greenhorn

Joined: Apr 30, 2008
Posts: 20
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

Joined: Apr 14, 2004
Posts: 10336

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need to know Sql version.