I have a DBCP connection pool in Tomcat. The problem is that when the connection is shorted, the application is interrupted because DBCP will not try to reconnect later when there is a connection. Can I get DBCP to automatically connect?
There are two ways to "solve" this, although both have some problems:
You can use "validationQuery" (see below) to run a test query before you go (usually something like "select 1 from dual", which will be used to check connections before / after you receive / give back they are added by an additional call to request a connection from the pool. See http://wiki.apache.org/commons/DBCP
Instead, for each request, you can use idleEvictorThread by setting testWhileIdle, although in some versions this thread may cause blocking under heavy load. See http://commons.apache.org/dbcp/configuration.html for more information about this and other options.
Do not think DBCP does this, but BoneCP ( http://jolbox.com ) can be configured to automatically play back any transactions when the database or network goes down. It is completely transparent to your application.
Source: https://habr.com/ru/post/1305599/More articles:How can I programmatically make Windows XP display thumbnails for a folder? - windows-xpNhibernate's ManyToMany Free Collection - No Rescue Associations - c #Adding functionality to any TextReader - c #Java / Swing: problem with fast / slow UI - javaWorking with files and diagrams of a .NET project? - .netCan we host the workflow service as a windows service? - workflowHomepage - drupalShould I use a "refund"; after the header ()? - phpWhere are the real risks in network security? - securityThe DataTemplate defined in XAML has a VisualTree value of zero - c #All Articles