Announcement Announcement Module
No announcement yet.
dbcp data source and validation queries Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • dbcp data source and validation queries

    I'm using the dbcp BasicDataSource that Roo ships with and notice that, with MySQL, connections time out after 8 hours of inactivity, but dbcp does not check the connection status before running a query.

    I'm not sure what the best practice is here (I've not used dbcp much) but I've added the following properties to my data source bean.

    <property name="validationQuery" value="SELECT 1" />
    <property name="testOnBorrow" value="true" />
    <property name="testOnReturn" value="false" />
    This might make sense as a default for MySQL / dbcp; or there might be better approaches. Any thoughts anyone?


  • #2
    I would expect that after a timeout there would be an automatic attempt to reconnect anyway. Not sure why this would work differently with mysql than any other DB. I certainly have not seen that issue when I let the app run over weeks without any activity and it worked just fine once I got back to it.

    Maybe, this is something that needs adjustment in dbcp?