File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Establishing JDBC Connection Using Port Ips Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Establishing JDBC Connection Using Port Ips" Watch "Establishing JDBC Connection Using Port Ips" New topic

Establishing JDBC Connection Using Port Ips

nivas khan

Joined: Aug 08, 2001
Posts: 7
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

Joined: Aug 06, 2001
Posts: 34

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());

Dil se....,<BR>Dayanand<BR>0065-8839071(off)<BR>0065-7547034(Res0
It is sorta covered in the JavaRanch Style Guide.
subject: Establishing JDBC Connection Using Port Ips
It's not a secret anymore!