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 Connection problem with oracle 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 "Connection problem with oracle" Watch "Connection problem with oracle" New topic

Connection problem with oracle

deepak buddineni

Joined: Apr 30, 2008
Posts: 4
I am trying to connect to oracle 10 g databas on my local system. operating system is vista. A using netbeans IDE

I checked tha database name using the following query:

SQL> select name from v$database;


this shows that i am using the correct sid in url.
also the user name and password are correct.

But the error says:

java.sql.SQLException: Io exception: The Network Adapter could not establish the connection

can some one help me onthis.
K Kiran Kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 109
Hi Deepak,

Just try out giving the IP address in place of "localhost" in the URL...

Also try out
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
instead of Class.forName()...

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Also try out
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
instead of Class.forName()...

This is generally a bad idea. It ties your implementation to an oracle database. You should only need to explicitly refer to the Oracle driver if you are planning to use some of its proprietory functionality. You also know the driver being registered is not the issue, because if the DriverManager could not find a driver to service the url you provide it would tell you.

Vista, unlike previous Microsoft OSs, comes with a firewall which is by default turned on. You might want to check this is not what is blocking your connection.

Cna you connect via SQLPlus? Can you connect with any of the other developer tools provided with your install?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: Connection problem with oracle
jQuery in Action, 3rd edition