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.
Asked
Active
Viewed 311 times
0
-
You can start from checking database connection using `tnsping` – Sayan Malakshinov Jun 29 '21 at 00:07
-
Can you connect directly with the driver and the same parameters, if you're ruling out the connection pool? It might be the connections that time out, but the pool trying again desperately to provide you with a connection. – Olaf Kock Jun 29 '21 at 07:33
-
Any suggestions on this ? – lgriffin Jul 12 '21 at 15:21
1 Answers
0
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.
-
Thanks for you response. I know the firewall isn't an issue and I have tried different versions of the OJDBC driver. The max active sessions configured in the BasicDataSource is set to 33 and the max wait is two minutes, so I would expect the first 33 connections to return and any other connections to timeout after two minutes if no connections are freed in the connection pool. I created a test app with the same settings and it does timeout with an exception as expected but in our main application it is not timing out. – lgriffin Jun 30 '21 at 13:38