*
The moose likes JDBC and the fly likes error in jdbc connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "error in jdbc connection" Watch "error in jdbc connection" New topic
Author

error in jdbc connection

bhagya raavi
Greenhorn

Joined: Aug 26, 2008
Posts: 9
i am getting the following exception
java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
i am using the following code in jsp
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbcracle:thin:@localhost:1521:xe", "scott", "tiger");
sangram mhatre
Greenhorn

Joined: Apr 02, 2005
Posts: 15
Please check , if the database is running and listener is running and the details you have provided in connection url are correct .
bhagya raavi
Greenhorn

Joined: Aug 26, 2008
Posts: 9
Originally posted by sangram mhatre:
Please check , if the database is running and listener is running and the details you have provided in connection url are correct .

thanku,sir
but all that are correct only
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1135

Originally posted by bhagya raavi:

thanku,sir
but all that are correct only


Baghya,
I doubt it.
Looks like you are using Oracle Express Edition (XE) database.
I don't think the SCOTT sample schema is installed on that database.
XE installs the HR sample schema.
Your database connection URL also looks incorrect and package "oracle.jdbc.driver" has been deprecated.
Now can you verify your claim that all the above is correct?
If you haven't already done so, I recommend reading the JDBC Developer's Guide and Reference which is part of the Oracle documentation and is available online.
Just google it.
You need the Oracle 10g documentation.

Good Luck,
Avi.
sangram mhatre
Greenhorn

Joined: Apr 02, 2005
Posts: 15
Are you able to connect to the database xe with user name scott and password tiger externally using sqlplus ? Also can you provide your tnsnames entry ?
bhagya raavi
Greenhorn

Joined: Aug 26, 2008
Posts: 9
Originally posted by Avi Abrami:


Baghya,
I doubt it.
Looks like you are using Oracle Express Edition (XE) database.
I don't think the SCOTT sample schema is installed on that database.
XE installs the HR sample schema.
Your database connection URL also looks incorrect and package "oracle.jdbc.driver" has been deprecated.
Now can you verify your claim that all the above is correct?
If you haven't already done so, I recommend reading the JDBC Developer's Guide and Reference which is part of the Oracle documentation and is available online.
Just google it.
You need the Oracle 10g documentation.

Good Luck,
Avi.

thankyou for yoursugession
how to verify that those are correct
sangram mhatre
Greenhorn

Joined: Apr 02, 2005
Posts: 15
Are you able to connect to the database xe with user name scott and password tiger externally using sqlplus ? Also can you provide your tnsnames entry ?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: error in jdbc connection