Evan,

I had turned on validation queries, but apparently had a typo - I 
discovered that my container is using an outdated version of my config.yml 
that had 'select 1' for the validation query, and *checkConnectionWhileIdle* 
was 
set to false.  I'll correct this and give it a shot.  Thanks for the tip!

The behavior you are seeing seems interesting however - is there an issue 
open where you're tracking it? :-)

On Monday, December 12, 2016 at 1:01:22 PM UTC-5, Evan Meagher wrote:
>
> Hello Val,
>
> It sounds like you're using `DBI.onDemand` as it's intended. The typical 
> case is to create a set of DAO objects once via `DBI.onDemand` from within 
> an `Application#run` method.
>
> However, I too am currently trying to debug cases where stale database 
> connections (e.g. after a DB server restart) aren't removed from the pool. 
> In my case, this occurs even when I have jDBI configured to perform 
> periodic validation queries to the database.
>
> Val, are you using validation queries? These can be configured with the 
> `database.{validationQuery, validationQueryTimeout, 
> checkConnectionWhileIdle, evictionInterval}` configuration options.
>
> On Mon, Dec 12, 2016 at 8:08 AM, Val Akkapeddi <[email protected] 
> <javascript:>> wrote:
>
>> Hi all!  I had a question about the lifetime of dao instances created 
>> using DBI.onDemand in DropWizard JDBI.  Currently, I am creating the 
>> instances once during the initialization of my DropWizard application and 
>> persisting them for the lifetime. Is this the proper way to use onDemand, 
>> or should I get a new DAO instance every time I want to run a query?  
>>
>>
>> I have observed a situation where if you're running Dropwizard inside a 
>> Docker & let it idle for a day or so, my dao instances aren't reopening 
>> connections to the RDBMS - I just see "connection is closed" errors, as if 
>> jdbi is attempting to execute queries against a connection that's closed.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "dropwizard-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Evan Meagher
>

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to