Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8894399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:29:11+00:00 2026-06-14T23:29:11+00:00

When I start my application I test my internal database is okay as follows:

  • 0

When I start my application I test my internal database is okay as follows:

HibernateUtil.beginTransaction();

This is a H2 database. I’m using Hibernate on top with c3p0 pooling.

Trouble is it takes one minute to decide that it cannot being a transaction, I’d like it to retry within 10 seconds. I’ve looked at c3p0 properties and cannot see anything that does this.

* Update *
Comment made me realize that HibernateUtil.beginTransaction() was hiding what I was doing so replaced with:

System.out.println("Get Session"+new Date());
Session session = com.jthink.songlayer.hibernate.HibernateUtil.getSession();
System.out.println("Get Txn"+new Date());
Transaction t = session.getTransaction();
System.out.println("Set Timeout"+new Date());
t.setTimeout(10);
System.out.println("Begin Txn"+new Date());
session.beginTransaction();
System.out.println("Commit"+new Date());
t.commit();

Output is

Get SessionWed Nov 21 12:15:56 GMT 2012
Get TxnWed Nov 21 12:16:27 GMT 2012
Set TimeoutWed Nov 21 12:16:27 GMT 2012
Begin TxnWed Nov 21 12:16:27 GMT 2012
FailedWed Nov 21 12:16:46 GMT 2012

So it seems 30 seconds is spent getting a Session (unclear how it can even get a Session as the database is corrupt) and then 19 seconds trying to begin transaction

whereas when the database is fine, the timings are a few seconds

Get SessionWed Nov 21 12:23:57 GMT 2012
Get TxnWed Nov 21 12:23:59 GMT 2012
Set TimeoutWed Nov 21 12:23:59 GMT 2012
Begin TxnWed Nov 21 12:23:59 GMT 2012
CommitWed Nov 21 12:23:59 GMT 2012

So the main problem seems to be that it takes a longtime to (sort of) get a Session when db corrupt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:29:12+00:00Added an answer on June 14, 2026 at 11:29 pm

    I suppose you didn’t configure acquireRetryAttempts for your C3P0 and it tries to connect to the database for 30 times which is the default value. Decrease this value and you’ll get it much faster.

    Also there are options you might want to tune:

    • acquireRetryDelay (default: 1s)
    • breakAfterAcquireFailure (default: false)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using automation to test an application, but sometimes I want to start the
i am newbie to mongoDB ,as i start working with test application (ASP.Net) found
I'm trying to test start state of my application when it is freshly launched,
I'm using the WatiN, but when i developed my application test, i was using
Is it possible to start an application test that runs in the simulator with
I want to be able to start my play application in test mode on
I've never done a Java Web start application before. I wrote my app's JNLP
I have a Java Web Start application. I specify the resource (jars, images, etc)
I don't know how make my application as auto start application.That is my expectation
I'm going to develop a java web start application, which need to access protected

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.