Java BasicDataSource getting stuck when connecting

412 views Asked by At

I am using the DBCP component of the Apache Commons library to connection to an Oracle database. I have created a BasicDataSource object and set the MaxWait time to two minutes. However when I call the "getConnection" method to get a connection it never returns or times out. I am try to connect to an Oracle 12.1.0.2 database. What could the cause of this be ? Thanks.

1

There are 1 answers

1
AudioBubble On

There can be many reasons like: A firewall between the client and the server. A odbc driver that is too old to be accepted by the database. Incorrect connection details. Wrong driver. Using a database user that has no access.

Some kind of instrumentation can help.

First things to check: is the port open on the io that is used? Is a listener waiting there to handle my connection attempt? Next step is to check the connection with a client that is known to work: sqlplus. If the sqlplus connection works, your jdbc client also makes a chance.