aspose file tools*
The moose likes JDBC and the fly likes MS SQL Server, Connection String - Defining Port Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MS SQL Server, Connection String - Defining Port" Watch "MS SQL Server, Connection String - Defining Port" New topic
Author

MS SQL Server, Connection String - Defining Port

Steven Fischer
Greenhorn

Joined: Jun 28, 2001
Posts: 5
Hello all!
I am getting set to launch a web application I have developed using the JDBC-ODBC bridge that Sun provides (I know its a flaky driver, cost prohibits me from exploring other options). The database server I am connection to requires that database requests come through a non-standard port. How would I modify my connection string to handle this?
The string is as follows:
String dataPath = "jdbcdbcRIVER={SQL Server};SERVER={ip_address};DATABASE=MY_DBASE;UID=USER_NAME;PWD=my_pass";
Thanks for your help. If you have any recommendations on JDBC drivers for MS SQL server that don't cost an arm and a leg, please let me know as well!
Steve
Lee Wallen
Greenhorn

Joined: Jul 14, 2001
Posts: 10
I am unsure if this will work, but try something like this:

String dataPath = "jdbc dbc RIVER={SQL Server}:SERVER={ip_address}:<port>?DATABASE=MY_DBASE";
where <port> is the value of the port you want to use...like 1433 or something like that.
Use the user id and password like this:
Connection conn = DriverManagner.getConnection( dataPath, USER_NAME, my_pass);
[This message has been edited by Lee Wallen (edited July 15, 2001).]
[This message has been edited by Lee Wallen (edited July 15, 2001).]
James Chrystal
Greenhorn

Joined: Jul 12, 2001
Posts: 3
For a pretty good JDBC Driver, go to www.freetds.org, and download theirs. I'm currently using it for developing a SQL Server based system.
JC
Steven Fischer
Greenhorn

Joined: Jun 28, 2001
Posts: 5
Thanks for the link - its nice to hear from someone who is using it in their project.
 
wood burning stoves
 
subject: MS SQL Server, Connection String - Defining Port