• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Connection Time Out

 
Tanzy Akhtar
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • 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.
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two solution I thought of:
1. Increase the connection time out variable time in your Database environment.
2.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thank You Vijitha.

 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic