Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>To be very honest there are three solutions to your problems. I will explain each solution and pros and cons of every solution (will come to your case in last)</p> <ol> <li><p>configure wait_time_out property in mysql my.ini file to make sure your connections are timed out. This approach will definitely work but no way this is a good solutions. you would love to handle this thing in your application rather than in database because at times you might not be having that much control over the database or some other application might be using the same database.</p></li> <li><p>Use apache dbcp instead of c3p0. You can configure the dbcp in context.xml of your server where you give name of the database. This approach will work but problem with this approach is you might plan to switch to some other application server say JBOSS in future, in that case i am not apache dbcp will work or not. I have not tried it with jboss but guess is it won't.</p></li> <li><p>Third way is what you have opted for</p></li> </ol> <p>In your case you are missing one property, that is</p> <pre><code>&lt;property name="connection.provider_class"&gt; org.hibernate.connection.C3P0ConnectionProvider &lt;/property&gt; </code></pre> <p>Till now you must have noticed during your server startup that c3p0 is not initialized at all. Well if you are thinking after setting this property your code will work, I am sorry to say, it will not.</p> <p>This is due to a bug in spring code. you can verify this by looking at the source code of LocalSessionFactoryBean, where it simply ignore the value of property set above and sets it to LocalDataSourceConnectionProvider and your c3p0 is never initialized.</p> <p>You can provide the custom implementation of LocalSessionFactoryBean , where you can hard code the provider class to C3P0ConnectionProvider.</p> <p>Now restart the server and note your c3p0 is initialized and now you can deal with c3p0 details.</p> <p>Problem till now with you is that c3p0 is never initialized and is out of picture.</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload