aspose file tools*
The moose likes JDBC and the fly likes getconnection() --> SQLException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "getconnection() --> SQLException" Watch "getconnection() --> SQLException" New topic
Author

getconnection() --> SQLException

Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Hi,
I have Oracle 8i personnal editon, jdk1.3, window98. I have installed the thin driver.
I tried to getconnection() it gives me error
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
My code

In the getconnection, we have to pass hostname, port# and sid.
I want to use oracle8i personnal edition, so I am using localhost, 1521 and ORCL. But I don't know what the SID is.
Thanks,
Vanitha.

[This message has been edited by Vanitha Sugumaran (edited October 29, 2001).]
sanjay yermalkar
Greenhorn

Joined: Sep 19, 2001
Posts: 23
SID is the "host String" you pass to connect to your local oracle database usind SQL*Plus. Basically, It's the name of the database you want to connect to.
Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Thanks for your reply Sanjay. I am totally new to this subject. So kindly guide me through this.
I don't know how to find the SID. I am using oracle8i personnal edition.
When I use sqlplus, I am not entering anything in the hoststring option. It is working fine for me.
I need to connect jdbc to oracle here is where I am having trouble with SID.
Vanitha.
sanjay yermalkar
Greenhorn

Joined: Sep 19, 2001
Posts: 23
The default database name is the one you provided while installing oracle. You can get it from the file -
<oracle_home>\network\ADMIN\tnsnames.ORA
It should look like this:


Here, "RAM" is the name of the default database I entered while installing oracle.
I could access my personal oracle by having SID = RAM in my java program.
hope this helps!

[This message has been edited by sanjay yermalkar (edited October 29, 2001).]
Vanitha Sugumaran
Ranch Hand

Joined: Apr 11, 2001
Posts: 356
Thanks a lot sanjay!
Vanitha.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getconnection() --> SQLException
 
Similar Threads
JDBC Error :- End of TNS data Channel. SQL Exception Error
Connection refused using datadirect jdbc
ClassNotFoundException while trying to connect to Oracle
How to use IN OUT parameter
not able to connect with 10g