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 oracle error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "oracle error" Watch "oracle error" New topic

oracle error

jacq carballo
Ranch Hand

Joined: Feb 10, 2002
Posts: 42
I have made a small program that will connect to the oracle db. I also added catch blocks to find out when something goes wrong.
This is the code block:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url = "jdbc racle:thin:";
String username = "user";
String password = "password";
This is the error:
SQLState: null
Message: Io exception: The Network Adapter could not establish the connection
when i try the same code with the sqlserver (of course i changed the first line to Class.forName(, the url, username and password), it works just fine.
Can anyone tell me what is wrong with the code above? What can i do to remove the error?
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673
String url = "jdbc: oracle:thin@<SID>;
I hope this helps
[ February 14, 2002: Message edited by: Nigel Browne ]
[ February 14, 2002: Message edited by: Nigel Browne ]
jacq carballo
Ranch Hand

Joined: Feb 10, 2002
Posts: 42
I made the code changes but this next problem came out:
SQLState: null
Message: Invalid Oracle URL
Vendor: 17067
I am sure that the IP address and the port number i used are correct because i telnet to them all the time (and i rechecked them to make sure i did not do any typo error).
Thanks in advance.
martin samm
Ranch Hand

Joined: Nov 09, 2000
Posts: 31
the connection string is missing a colon. It should be :
jdbc racle:thin:@<machineip/name>:<port>:<sid>

martin samm<BR>
I agree. Here's the link:
subject: oracle error
It's not a secret anymore!