You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "spike@12" <ko...@gmail.com> on 2011/11/09 08:00:30 UTC

how to connect to datasource

Hi,

I have setup my application using with tomcat and it is working fine. But
when I have restarted my DB machine, my application is not working. If I
have restart my tomcat server then it is working fine.
may I  know, how to connect to datasource automatically if my DB machine is
restarted?? Is it having any specific parameter to connect datasource
automatically??

Please let me know. Thanks in advance.
-- 
View this message in context: http://old.nabble.com/how-to-connect-to-datasource-tp32809000p32809000.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: how to connect to datasource

Posted by Pid <pi...@pidster.com>.
On 09/11/2011 08:34, spike@12 wrote:

Please don't top-post.

>> Read:
>>
>>  http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html
>>
>> Pay attention to the paragraph which refers to the 'validationQuery'
>> attribute.

>
> No. I am using tomcat 6.0, java 6.0, linux system.

Crikey.  That changes everything.

 http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html


p



-- 

[key:62590808]


Re: how to connect to datasource

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

spike@12,

On 11/9/11 8:59 PM, spike@12 wrote:
> now it is working fine, after adding validationQuery,testOnBorrow
> parameters.

Note that testOnBorrow=true is the default, so you don't really need
to set it.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk67axUACgkQ9CaO5/Lv0PBycQCdFGhOUFUdkBiKgz7owBmU7Rb1
BnkAniREhIcZ+4nNKlT9RKCvFPxnvHng
=vMWk
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: how to connect to datasource

Posted by "spike@12" <ko...@gmail.com>.
now it is working fine, after adding validationQuery,testOnBorrow parameters.
Thanks to all. 

billybob79 wrote:
> 
>     >> may I  know, how to connect to datasource automatically if my DB
> machine
> 
>>  >> is
>> >> restarted?? Is it having any specific parameter to connect datasource
>> >> automatically??
>>
> 
> How does the existing app connect to the database? Can you show the code
> please - remove any sensitive passwords
> 
> Thanks
> 
> Chris
> 
> 

-- 
View this message in context: http://old.nabble.com/how-to-connect-to-datasource-tp32809000p32816289.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: how to connect to datasource

Posted by chris derham <ch...@derham.me.uk>.
    >> may I  know, how to connect to datasource automatically if my DB
machine

>  >> is
> >> restarted?? Is it having any specific parameter to connect datasource
> >> automatically??
>

How does the existing app connect to the database? Can you show the code
please - remove any sensitive passwords

Thanks

Chris

Re: how to connect to datasource

Posted by "spike@12" <ko...@gmail.com>.
No. I am using tomcat 6.0, java 6.0, linux system.


Pid * wrote:
> 
> On 09/11/2011 07:00, spike@12 wrote:
>> 
>> Hi,
>> 
>> I have setup my application using with tomcat and it is working fine. But
>> when I have restarted my DB machine, my application is not working. If I
>> have restart my tomcat server then it is working fine.
>> may I  know, how to connect to datasource automatically if my DB machine
>> is
>> restarted?? Is it having any specific parameter to connect datasource
>> automatically??
>> 
>> Please let me know. Thanks in advance.
> 
> It's better to tell us precise details about your Tomcat, Java and OS
> version when asking a question.  I'll assume 7.0.
> 
> A validation query may help.  Note: restarting a DB while the
> application server is up is often prone to problems.
> 
> Read:
> 
>  http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html
> 
> Pay attention to the paragraph which refers to the 'validationQuery'
> attribute.
> 
> 
> p
> 
> 
> 
> -- 
> 
> [key:62590808]
> 
> 
>  
> 

-- 
View this message in context: http://old.nabble.com/how-to-connect-to-datasource-tp32809000p32809339.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: how to connect to datasource

Posted by Pid <pi...@pidster.com>.
On 09/11/2011 07:00, spike@12 wrote:
> 
> Hi,
> 
> I have setup my application using with tomcat and it is working fine. But
> when I have restarted my DB machine, my application is not working. If I
> have restart my tomcat server then it is working fine.
> may I  know, how to connect to datasource automatically if my DB machine is
> restarted?? Is it having any specific parameter to connect datasource
> automatically??
> 
> Please let me know. Thanks in advance.

It's better to tell us precise details about your Tomcat, Java and OS
version when asking a question.  I'll assume 7.0.

A validation query may help.  Note: restarting a DB while the
application server is up is often prone to problems.

Read:

 http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html

Pay attention to the paragraph which refers to the 'validationQuery'
attribute.


p



-- 

[key:62590808]