This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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 ?
Joined: Jul 14, 2008
It would be really helpful to me if someone gives light on this.
Please help me.
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).
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.
Joined: Jul 14, 2008
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.
Joined: Jan 25, 2008
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.