You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by se...@gmail.com on 2008/05/22 10:43:47 UTC

recreation of connections in the dbcp

Hello,

I use database connection pool BasicDataSource for manegment of DB
connections. When DB Server is restarted all connections are loosed.
How can I handle this situation? Should I create new BasicDataSource
or invoke some method.

Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: recreation of connections in the dbcp

Posted by se...@gmail.com.
Thank you guys!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: recreation of connections in the dbcp

Posted by Siegfried Goeschl <si...@it20one.at>.
And this also works for mySQL

Siegfried Goeschl

Mark Shifman wrote:
> for Oracle use
>
> validationQuery="SELECT 1 from dual"
>
> James Carman wrote:
>   
>> I'd use a validation query.  I believe that will solve your problem.
>> That way, the pool implementation can check to see that the connection
>> is "valid" before handing it off to you.  For HSQLDB, I use:
>>
>> select 1 from INFORMATION_SCHEMA.SYSTEM_USERS
>>
>> You can come up with something similar for other database products.
>> Hope that helps!
>>
>> On Thu, May 22, 2008 at 4:43 AM,  <se...@gmail.com> wrote:
>>     
>>> Hello,
>>>
>>> I use database connection pool BasicDataSource for manegment of DB
>>> connections. When DB Server is restarted all connections are loosed.
>>> How can I handle this situation? Should I create new BasicDataSource
>>> or invoke some method.
>>>
>>> Thank you.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: user-help@commons.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>     
>
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: recreation of connections in the dbcp

Posted by Craig Spry <cr...@gmail.com>.
For Postgres I use:
select now()

On Thu, May 22, 2008 at 10:06 PM, Mark Shifman <ma...@yale.edu>
wrote:

> for Oracle use
>
> validationQuery="SELECT 1 from dual"
>
> James Carman wrote:
> > I'd use a validation query.  I believe that will solve your problem.
> > That way, the pool implementation can check to see that the connection
> > is "valid" before handing it off to you.  For HSQLDB, I use:
> >
> > select 1 from INFORMATION_SCHEMA.SYSTEM_USERS
> >
> > You can come up with something similar for other database products.
> > Hope that helps!
> >
> > On Thu, May 22, 2008 at 4:43 AM,  <se...@gmail.com> wrote:
> >> Hello,
> >>
> >> I use database connection pool BasicDataSource for manegment of DB
> >> connections. When DB Server is restarted all connections are loosed.
> >> How can I handle this situation? Should I create new BasicDataSource
> >> or invoke some method.
> >>
> >> Thank you.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: user-help@commons.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
> >
>
>
> --
>  Mark Shifman MD. Ph.D.
>  Yale Center for Medical Informatics
>  Phone (203)737-5219
>  mark.shifman@yale.edu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: recreation of connections in the dbcp

Posted by Mark Shifman <ma...@yale.edu>.
for Oracle use

validationQuery="SELECT 1 from dual"

James Carman wrote:
> I'd use a validation query.  I believe that will solve your problem.
> That way, the pool implementation can check to see that the connection
> is "valid" before handing it off to you.  For HSQLDB, I use:
> 
> select 1 from INFORMATION_SCHEMA.SYSTEM_USERS
> 
> You can come up with something similar for other database products.
> Hope that helps!
> 
> On Thu, May 22, 2008 at 4:43 AM,  <se...@gmail.com> wrote:
>> Hello,
>>
>> I use database connection pool BasicDataSource for manegment of DB
>> connections. When DB Server is restarted all connections are loosed.
>> How can I handle this situation? Should I create new BasicDataSource
>> or invoke some method.
>>
>> Thank you.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 


-- 
 Mark Shifman MD. Ph.D.
 Yale Center for Medical Informatics
 Phone (203)737-5219
 mark.shifman@yale.edu

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: recreation of connections in the dbcp

Posted by James Carman <ja...@carmanconsulting.com>.
I'd use a validation query.  I believe that will solve your problem.
That way, the pool implementation can check to see that the connection
is "valid" before handing it off to you.  For HSQLDB, I use:

select 1 from INFORMATION_SCHEMA.SYSTEM_USERS

You can come up with something similar for other database products.
Hope that helps!

On Thu, May 22, 2008 at 4:43 AM,  <se...@gmail.com> wrote:
> Hello,
>
> I use database connection pool BasicDataSource for manegment of DB
> connections. When DB Server is restarted all connections are loosed.
> How can I handle this situation? Should I create new BasicDataSource
> or invoke some method.
>
> Thank you.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org