wood burning stoves*
The moose likes JDBC and the fly likes JDBC connectivity problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC connectivity problem" Watch "JDBC connectivity problem" New topic
Author

JDBC connectivity problem

kiruthika raghunathan
Greenhorn

Joined: Dec 03, 2003
Posts: 9
I dont have the client application Oracle in my sys.
If i use oracle thin jdbc it is not necessary to have oracle in the ys.
i downloaded the driver ojdbc14.jar from the site
i donno whether i have to include anything in the class path
and my code is
import java.sql.*;
import java.io.*;
import java.util.*;
public class OraTest
{

public static void main(String args[])
{
try{
String User="scott";
String Passwd="tiger";
String OraConStr = "jdbc racle:thin:scott/tiger@(description=(address_list=(address=(protocol=tcp)(host=192.168.4.45)(port=1521)))(connect_data=(SERVICE_NAME = test)))";
StringBuffer stbTmp = new StringBuffer();
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection OraCon=DriverManager.getConnection(OraConStr,User,Passwd);
System.out.println("Connected to Oracle");
}
catch(Exception ex)
{
System.out.println(ex);
}
}
}
If i run this iam getting some run time exception
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
wat is the problem?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Originally posted by kiruthika raghunathan:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
wat is the problem?

Make sure 192.168.4.45 is the right IP address for the Oracle server, that you can ping that IP, that the port you have specified is the correct one for the Oracle DB, and that the service name you have specified exists.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
kiruthika raghunathan
Greenhorn

Joined: Dec 03, 2003
Posts: 9
thanx a lot for ur reply
ur right the ip address is wrong in the code
Kay Liew
Ranch Hand

Joined: Dec 26, 2003
Posts: 112
Good to hear that you have solve the problem. The error message can also means your services did not started properly. Either the TNSagent or the database services.
EQ


Unity can only be manifested by the Binary. Unity itself and the idea of Unity are already two.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC connectivity problem