Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate timeout

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys : Is there a way to set a hibernate database connection timeout, i.e.

[code]
Configuration c = ...
c.setProperty("hibernate.show_sql", "true");
c.setProperty("use_sql_comments","true");
c.setProperty("hibernate.timeout", "10");
[code]

?

I have an application that uses hibernate, that hangs for a very long time when the database isnt installed... I'd rather just have it throw a timeout exception.


Thanks
Jay
 
Pierre Henry
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

You should try to throw a timeout exception at jdbc level.
 
Saket Chauhan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:roll: :roll:
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK thanks ... how can i configure my jdbc driver that is used by hibernate to throw an timeout exception ? I'm using the commonly used Mysql jdbc driver (com.mysql.jdbc.Driver) class.
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have solved this problem by extending ConnectionProvider.... Anyone needing the code to do so feel free to email me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic