• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting Connection Time Out

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Is there any way to set the connection object so that it will preserve
for a given time.
For instance, if we create a connection object and this connection object
must not be timed out before half an hour.

I need this because in my module i am creating connection object when connection is null.
Once connection got created, it preserved.

This module executes for more than three hour.
Now what is happening that module becomes idle for some time aqnd then throwing
exception of connection timed out.

This is why i need to set connection preserve time.

Or, Is there any way to avoid connection time out error?

Any clue?

Thanks,
Tanzy.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two solution I thought of:
1. Increase the connection time out variable time in your Database environment.
2.
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are not using a connection pool? Or how you use the Connection (through DriverManager/...) ?
 
Tanzy Akhtar
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sagar,

Thanks for the reply.

Well i did not use first solution ever.
Could you please tell me how to do this.

In second, i am already doing it.


Thanks,
Tanzy.
 
Tanzy Akhtar
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vijitha,

Well i need just one connection object.
So is there any benefit to use connection pool?

Thanks,
Tanzy.
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

tanzy akhtar wrote:Well i need just one connection object.So is there any benefit to use connection pool?



Then no need.
 
Tanzy Akhtar
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You Vijitha.

 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

tanzy akhtar wrote:Well i did not use first solution ever.
Could you please tell me how to do this.


It depnds upon the datbase you're using, e.g in MySQL, we use this:
http://www.forum.psoft.net/archive/index.php/t-9752.html

tanzy akhtar wrote:In second, i am already doing it.


For second, I was bit wrong, actully I want to say like this;

 
Tanzy Akhtar
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow! Good one.

Thank you Sagar.

I will do it in my code.

Well the database we are using is oracle 10g.
So is there any diferent way to set the connection time out?


Thanks,
Tanzy.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

tanzy akhtar wrote:Well the database we are using is oracle 10g.
So is there any diferent way to set the connection time out?


Google JDBC + Oracle 10g + set timeout
between I found this attribute " inactivity-timeout", so you can construct your connection string, like this

 
reply
    Bookmark Topic Watch Topic
  • New Topic