This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Oracle Connectivity Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Oracle Connectivity Error" Watch "Oracle Connectivity Error" New topic

Oracle Connectivity Error

asheesh talwar
Ranch Hand

Joined: Dec 10, 2000
Posts: 31
When I run the following code I am getting this error
Can any one suggest where is the error & what is the best way to connect to oracle database using java.

(edited by Cindy to format code and turn off smilies.)

[This message has been edited by Cindy Glass (edited May 09, 2001).]
Bill Prentice

Joined: Mar 06, 2001
Posts: 26
The URL looks wrong, compare it to one of ours,
url = jdbc racle:thin:@ibms1:xxxx:dev3
where @ibms1 is the host server
xxxx is the port number
dev3 is the service name or sid
We do not include username and password since that is validated elsewhere but the form would be url - user - password.
Hope this helps

[This message has been edited by Cindy Glass (edited May 09, 2001).]
Sean MacLean
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
I'd also try a couple of extra catch statements. One around the Class.forName and one around the getConnection. This way you'll see if the problem is occuring because the driver is not loading properly (i.e. the Oracle dirvers are not in the class path or similar) or if the connection string is invalid. I suspect that it's the former.
asheesh talwar
Ranch Hand

Joined: Dec 10, 2000
Posts: 31
Bill I tried the url that you have specified but now
also I am getting this error while running it.
modified connection(con)where assetdb is the host server,1521 port id & assetdb is SID.
con = DriverManager.getConnection("jdbc racle:thin:@assetdb:1521:assetdb","asset","tiger");
Now I am getting this error
SQL Exception caughtjava.sql.SQLException: assetdb
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Oracle Connectivity Error
It's not a secret anymore!