Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Database Connection Hangs - getConnection()

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,
i have a serious problem with a database connectivity,
now the issue is,i have written the code to connect to the databaseserver which is in some remote place,it loads the driver,that's the oracle driver,but when it comes to DriverManager.getConnection,that's the connectivity with the database it hangs.Now first i thought their might be a network problem but then it should give a networkexception,and also i put some dummy userid,password and also the IPAddresse,port number ,and it gave me a SQLException,so i assume that their is no network problem.then my question is why does it get hangs when the control comes to the getConnection method,

what might be the problem?

Is there any problem with the database server? Please Help Me!
Masoud Kalali
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
some suggestion :
1-make sure that your connection URL is correct in regard to service name and SID name , for example :

If "ftdb" is your Oracle SID, connection would looks like :

If "ftdb" is your Oracle service name, connection would looks like :

if it is correct then
Do you tried to use tnsping from your computer againts the remote oracle server ?I think it is a restriction from your oracle server machine.
try tnsping and tell here whether it works or not.

if it does not workd (tnsping)
some questions :
java application hang on getting the connection , does it exit with a timeout,.. or it stays in hang situation without any change for long time ?

do you tried to ping the oracle server machine ?
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!