Skip to main content

Re: auto reconnect to database via JNDI after DB restart

2 replies [Last post]
mvatkina
Offline
Joined: 2005-04-04
Points: 0

Are there any transaction in progress when the DB goes down? You might
need to run 'recover-transactions' CLI. Otherwise it might be a DB issue.

-marina

On 6/26/13 5:31 AM, apache avro wrote:
> Hello Marina,
> Thanks for the quick suggestion.
> I have already tried using the connection validation attributes but it
> did not help.
>
> This is how the connection-pool looks like
>
> /<*jdbc-connection-pool* *name*="jdbc/test-pool"
> *res-type*="javax.sql.DataSource"
> *datasource-classname*="org.postgresql.ds.PGPoolingDataSource"
> *ping*="true" *pool-resize-quantity*="5" *max-pool-size*="10"
> *statement-cache-size*="10" *is-connection-validation-required*="true"
> *connection-validation-method*="table"
> *validation-table-name*="myschema.test">
> ...
> ...
> /
> //
>
> Please suggest.
>
> Thank You
>
>
> On Tue, Jun 25, 2013 at 4:10 PM, Marina Vatkina
> > wrote:
>
> Connection validation should help.
>
> -marina
>
>
> On 6/25/13 12:19 PM, apache avro wrote:
>
> Hello All,
> I have an application that uses JNDI to interact with
> postgresql. Whenever, there is a DB server restart, unless I
> restart glassfish I'm unable to interact with my DB. My
> efforts to use fail-all-connections,
> is-connection-validation-required and other attributes were
> futile.
>
> Please suggest a way to get my application to work with
> database without having to restart glassfish whenever I
> restart database server.
>
> Thank You
> Max
>
>
>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mvatkina
Offline
Joined: 2005-04-04
Points: 0

Actually my last idea wasn't right - you have a non-xa resource, so tx
recovery won't help (unless the same DB is indeed used as a tx resource
by another app).

Can you try with Derby to exclude Postgres problems?

thanks,
-marina

On 6/26/13 12:07 PM, apache avro wrote:
> No. No transactions in progress.
> Is there any way to debug this?
>
>
> On Wed, Jun 26, 2013 at 2:53 PM, Marina Vatkina
> > wrote:
>
> Are there any transaction in progress when the DB goes down? You
> might need to run 'recover-transactions' CLI. Otherwise it might
> be a DB issue.
>
> -marina
>
>
> On 6/26/13 5:31 AM, apache avro wrote:
>> Hello Marina,
>> Thanks for the quick suggestion.
>> I have already tried using the connection validation attributes
>> but it did not help.
>>
>> This is how the connection-pool looks like
>>
>> /<*jdbc-connection-pool* *name*="jdbc/test-pool"
>> *res-type*="javax.sql.DataSource"
>> *datasource-classname*="org.postgresql.ds.PGPoolingDataSource"
>> *ping*="true" *pool-resize-quantity*="5" *max-pool-size*="10"
>> *statement-cache-size*="10"
>> *is-connection-validation-required*="true"
>> *connection-validation-method*="table"
>> *validation-table-name*="myschema.test">
>> ...
>> ...
>> /
>> //
>>
>> Please suggest.
>>
>> Thank You
>>
>>
>> On Tue, Jun 25, 2013 at 4:10 PM, Marina Vatkina
>> > wrote:
>>
>> Connection validation should help.
>>
>> -marina
>>
>>
>> On 6/25/13 12:19 PM, apache avro wrote:
>>
>> Hello All,
>> I have an application that uses JNDI to interact with
>> postgresql. Whenever, there is a DB server restart,
>> unless I restart glassfish I'm unable to interact with my
>> DB. My efforts to use fail-all-connections,
>> is-connection-validation-required and other attributes
>> were futile.
>>
>> Please suggest a way to get my application to work with
>> database without having to restart glassfish whenever I
>> restart database server.
>>
>> Thank You
>> Max
>>
>>
>>
>
>

mvatkina
Offline
Joined: 2005-04-04
Points: 0

That's weird. May be the resource points to a different pool? Can you
try naming it jdbc-test-pool (i.e. without '/')?

thanks,
-marina

On 6/27/13 8:22 AM, apache avro wrote:
> Problem persists even with derby database.
>
> "*java.sql.SQLNonTransientConnectionException*: A communications error
> has been detected: Software caused connection abort: recv failed."
>
> Any ideas?
>
> Thank You
>
>
>
> On Wed, Jun 26, 2013 at 9:16 PM, apache avro
> > wrote:
>
> I'll try to do it as soon as I get in tomorrow. Thanks Marina.
>
>
> On Wed, Jun 26, 2013 at 4:52 PM, Marina Vatkina
> > wrote:
>
> Actually my last idea wasn't right - you have a non-xa
> resource, so tx recovery won't help (unless the same DB is
> indeed used as a tx resource by another app).
>
> Can you try with Derby to exclude Postgres problems?
>
> thanks,
> -marina
>
>
> On 6/26/13 12:07 PM, apache avro wrote:
>> No. No transactions in progress.
>> Is there any way to debug this?
>>
>>
>> On Wed, Jun 26, 2013 at 2:53 PM, Marina Vatkina
>> > > wrote:
>>
>> Are there any transaction in progress when the DB goes
>> down? You might need to run 'recover-transactions' CLI.
>> Otherwise it might be a DB issue.
>>
>> -marina
>>
>>
>> On 6/26/13 5:31 AM, apache avro wrote:
>>> Hello Marina,
>>> Thanks for the quick suggestion.
>>> I have already tried using the connection validation
>>> attributes but it did not help.
>>>
>>> This is how the connection-pool looks like
>>>
>>> /<*jdbc-connection-pool* *name*="jdbc/test-pool"
>>> *res-type*="javax.sql.DataSource"
>>> *datasource-classname*="org.postgresql.ds.PGPoolingDataSource"
>>> *ping*="true" *pool-resize-quantity*="5"
>>> *max-pool-size*="10"
>>> *statement-cache-size*="10"
>>> *is-connection-validation-required*="true"
>>> *connection-validation-method*="table"
>>> *validation-table-name*="myschema.test">
>>> ...
>>> ...
>>> /
>>> //
>>>
>>> Please suggest.
>>>
>>> Thank You
>>>
>>>
>>> On Tue, Jun 25, 2013 at 4:10 PM, Marina Vatkina
>>> >> > wrote:
>>>
>>> Connection validation should help.
>>>
>>> -marina
>>>
>>>
>>> On 6/25/13 12:19 PM, apache avro wrote:
>>>
>>> Hello All,
>>> I have an application that uses JNDI to interact
>>> with postgresql. Whenever, there is a DB server
>>> restart, unless I restart glassfish I'm unable
>>> to interact with my DB. My efforts to use
>>> fail-all-connections,
>>> is-connection-validation-required and other
>>> attributes were futile.
>>>
>>> Please suggest a way to get my application to
>>> work with database without having to restart
>>> glassfish whenever I restart database server.
>>>
>>> Thank You
>>> Max
>>>
>>>
>>>
>>
>>
>
>
>