File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Io exception: The Network Adapter could not establish the connection on Oracle 10g RACK Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Io exception: The Network Adapter could not establish the connection on Oracle 10g RACK" Watch "Io exception: The Network Adapter could not establish the connection on Oracle 10g RACK" New topic
Author

Io exception: The Network Adapter could not establish the connection on Oracle 10g RACK

Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
Hi all,
I am getting the starge exception while connecting to DB using eclipse indigo.

I tried to connect to DB I am getting . If I keep on trying after few time it connects.
I am connecting the same DB with other clients like ToAD, SQL Plus etc are working fine.

Details are :
Database : Oracle 10g RACK installation on Linux 2.4 machine
Client : elipse indigo (some JDBCE program) on windows XP

Usual reasones for this exception are
A. TNS Lister instance is down in the DB server
B. privileges are not granted for your credentials
C. given port is not visible/available
but none of the above are the reasons as some times conectivity is working fine and some times getting the exception

It looks strange behavior for me.
1. From few machines it works fine always
2. From few machines some times I get exception and somtimes it works fine

I dont know what to check.

Thanks in advance,
Appreciate the help.


SCJP 5 |SCWCD 5| Started thinking about Web Services ?
Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
It would be really helpful to me if someone gives light on this.
Please help me.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Contact your network adminstrator and/or database administrator. The connection between your code and the database server could not be made, and the fault probably does not lie in your code (unless you have a wrong connection URL).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
Yes I have contacted network admin but he said there will be some issue in client which I am using.
But I am using eclipse Indiigo. I don't know what is the issue with it
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Can you show us the code you're using for connecting?
Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
Thanks for the reply.

In fact I am using tomcat Data Source to connect to DB.
I am using class to get the connection from Data source.

I have added the Database entires in context.xml in tomcat as follows


my java Connection logic is


Please help me, I am facing this issue from 2 to 3 months.

john ho
Greenhorn

Joined: Jan 25, 2008
Posts: 8
Do you have to use that TNSNAMES style connection info in your jdbc url? It seems to include a lot of connect options which may actually be causing problems, if you aren't sure you actually need them. I mean this: "(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DBServiceName)(FAILOVER_MODE = (TYPE=session) (METHOD=basic)(RETRIES = 180) (DELAY =5)))"

What if you just used a standard jdbc url like jdbc:oracle:thin:@someHostname:myport:DBServiceName

Other than that, to debug this issue you need your database administrator to help trace the connection. When you get your "The Network Adapter could not establish the connection" error, the server should have a bit more information in the logs on the server side. It may help.
Amruth Puppala
Ranch Hand

Joined: Jul 14, 2008
Posts: 295
Thanks so much John, you have given very good info.

I have contacted Admin but he says my client may have problem.
My client info:
Eclipse Java EE IDE for Web Developers.
Version: Indigo Release
Build id: 20110615-0604

We are using correct options only for the connection string.

I do not understand why this exception comes some times and some times wokrs fine.

any help really appricated.

Regards
Amruth
john ho
Greenhorn

Joined: Jan 25, 2008
Posts: 8
well it looks like you only have problems with JDBC, since toad and sqlplus use native drivers to connect. i am actually not sure which jdbc driver eclipse uses, but i'm sure it's one of the thin ones.

if you really want to get to the bottom of this, check which driver eclipse uses, then write a small java program that uses that same driver to make a connection to the database with the same connection parameters. Run it many times until you get the error. But you will need cooperation from the DBA to trace the sessions to see really what the problem is.

but i guess since you only have the problem in your dev environment maybe the DBA doesn't want to make the effort in debugging an intermittent glitch ... after all it's not a showstopper, just an annoyance isn't it?

one other thing to try ... do you use SQL Developer from oracle (java based-graphical equivalent of sqlplus)? it also uses jdbc to connect to the database ... see if that has the problem as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Io exception: The Network Adapter could not establish the connection on Oracle 10g RACK
 
Similar Threads
Oracle JDBC Connectivity problem
Newbie: How doy I connect to Oracle Using JDBC
Problem connecting to database
connect oracle from java application
Oracle JDBC connection in a servlet