This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Establishing JDBC Connection Using Port Ips

nivas khan
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a Ms SQL server DB on my desktop.
And i want to connect to it using the methods described below.
but i am unable to connect.Can u help me with the code..
I have a win NT OS.What is the Ip adress to be given.

String dataPath = "jdbc dbc RIVER={SQL Server}:SERVER={ip_address}:?DATABASE=MY_DBASE";
where is the value of the port you want to 1433 or something like that.
Use the user id and password like this:
Connection conn = DriverManagner.getConnection( dataPath, USER_NAME, my_pass);
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

public Connection getConnection() throws SQLException
} catch (ClassNotFoundException cnfe) {
throw new SQLException(cnfe.getMessage());
} catch (IllegalAccessException iae) {
throw new SQLException(iae.getMessage());
} catch (InstantiationException ie) {
throw new SQLException(ie.getMessage());
Connection con = null;
Properties props = new Properties();
try {
con = DriverManager.getConnection("jdbc:weblogic:mssqlserver4:MY_DBASE@ip_address:1433",props);
return con;
} catch (Exception e) {
System.out.println("Exception :::"+e.getMessage());
throw new SQLException (e.getMessage());

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic