Opened 5 years ago

Closed 5 years ago

#2144 closed enhancement (fixed)

Implement a fast connection test against the database

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 3.14.1
Component: core Version:
Keywords: Cc:

Description

If there is some problem with connecting to the database there is a long delay before there is any information about this. The reason seems to be that the C3P0 connection pool manager is trying and re-trying for several minutes before starting to log anything in the log files and then waits some time more before a (long!) error message is displayed for the user. The error message is also a bit cryptic (see below) and the user has to scroll down a bit to understand that it is a problem with the database:

22:03:59,543  WARN BasicResourcePool:220 - Having failed to acquire a resource,
   com.mchange.v2.resourcepool.BasicResourcePool@309b6f2f is interrupting all 
   Threads waiting on a resource to check out. 
   Will try again in response to new client requests.
...

I think we should be able to make a faster check with a better error message at the same time as we check the JDBC driver (see [7533]).

Change History (1)

comment:1 by Nicklas Nordborg, 5 years ago

Resolution: fixed
Status: newclosed

(In [7577]) Fixes #2144: Implement a fast connection test against the database

The checkJdbcDriver() method was modified to also make a connection with the driver. If there is an error the error message from the database should be visible on the first line:

Could not connect to database: jdbc:postgresql:base (FATAL: password authentication failed for user "base2user")
Note: See TracTickets for help on using tickets.