Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have an Oracle database installed on one machine, and I am trying to accessing the same from another machine.

I tried via Oracle SQL developer eclipse, and even via JDBC program, butnothing works. I am not sure if it is firewall issue (I have ruled out this because both the machines are in same domain) or something to do with Oracle database setting. I know in MySQL you need to grant permission to connect to database remotely. Do we need to set something similar on oracle SID also?

The error message I get:

Io Exception: The Network Adapter could not establish the connection

share|improve this question
    
Do you have a listener running on the machine that has the database, an if so are you connecting to the right port? –  Alex Poole Feb 20 '12 at 13:56
    
and the database is installed on windows or linux? –  kevinsky Mar 9 '12 at 17:20
    
Please post the output of the command lsnrctl status. (From a terminal as the oracle user on Unix, or from a command prompt if on Windows) –  FreshPhilOfSO Apr 9 '12 at 15:23
add comment

3 Answers

Oracle is an enterprise database server so you shouldnt need any strange setup to get it working, just the correct configuration on the DB server or client will be enough.

When you get connection errors, i suggest first ensuring that the client machine can ping the database server where is the name or ip address - try both as it's possible the name may not be configured in the hosts file of the client machine. (Note that ping may be disabled due to security but if you get a reply back, you know the connection is good.A non reply may not mean the network is missing but you can try to ssh or telnet to the dbhost from the client machine as an alternative)

 unix> ping <dbhost>

Once you have confirmed the client machine can see the db server, you can check the configuration on the DB server.

On the DB server, if you connect with the following, you are connecting directly to the database without using TNS.

 unix> sqlplus user/pass 

If you connect instead with

 unix> sqlplus user/pass@ORACLE_SID

where ORACLE_SID is the identifier of the database, you will be using TNS, the same as your client machine. If this doesnt work locally, then it's also not going to work on the remote machine.

Check the listener is running

 unix> lsnrctl status

and if it's not, start it as the oracle user

 unix> lsnrctl start

and try again to connect using user/pass@ORACLE_SID

If this connects OK, then check your JDBC configuration to ensure you have specified the connection string correctly.

see http://javaeesupportpatterns.blogspot.de/2011/08/network-adapter-could-not-establish.html for assistance with the correct jdbc connection string.

share|improve this answer
add comment

I tried this but it doesnt work for me:

At the SQL Command Line prompt, enter the following command:

EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

I would love to know the secret sauce to get the above command to be effective. It did enable the port though so I can now telnet to it. Unfortunately, still cant login with JDeveloper; it denies my login for some unknown reason.

share|improve this answer
add comment

I would suggest trying an SSH tunnel (if this is only for development purposes for an application). I have done this to MYSQL / ORACLE a number of times for my clients, and I could remote from anywhere and just port forward it to the remote server over SSH tunnel.

Refer to this SO Question: http://stackoverflow.com/questions/3653788/how-can-i-connect-to-oracle-db-through-ssh-tunnel-chain-double-tunnel-server-i

I know this doesn't address the issue, but I thought it would be something you could try depending on your need, I've done this repeatedly for development purposes.

share|improve this answer
    
Neat suggestion. I could use Hamachi to do that. Thanks. –  djangofan Mar 9 '12 at 22:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.