Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MS SQL Server, Connection String - Defining Port

 
Steven Fischer
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link - its nice to hear from someone who is using it in their project.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic