Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: JDBC rollback failed

  1. #11
    Join Date
    Sep 2006
    Posts
    21

    Default

    Hi Andreas,

    I didn't match DBCP with C3P0. I used only DBCP. Between the app and DB there isn't any firewall. They are on the same machine.

    Just for testing I put on the same machine with my app another application from Internet. I configured it to use my DB. This second app has the same Hibernate configuration. Actually, from this second app I copied the configuration code.
    This second app doesn't crash after 20 h.
    Which should be the problem?


    P.S. Till now I didn't use this property in my hibernate.cfg.xml
    <property name="connection.pool_size">2</property>

    Maybe this is the problem?!

  2. #12
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    Quote Originally Posted by tarjoadi View Post
    P.S. Till now I didn't use this property in my hibernate.cfg.xml
    <property name="connection.pool_size">2</property>

    Maybe this is the problem?!
    That would be strange. But you could try it out, in order to be sure.

  3. #13
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Quote Originally Posted by tarjoadi View Post
    I didn't match DBCP with C3P0. I used only DBCP. Between the app and DB there isn't any firewall. They are on the same machine.
    So you are only working the the dataSource, you've removed the other properties e.g.
    Code:
    <property name="c3p0.acquire_increment">1</property> 
    <property name="c3p0.idle_test_period">100</property> <!-- seconds --> 
    <property name="c3p0.max_size">100</property> 
    <property name="c3p0.max_statements">0</property> 
    <property name="c3p0.min_size">10</property> 
    <property name="c3p0.timeout">100</property> <!-- seconds -->
    We used to use testOnBorrow and never had any problems in this respect.
    Last edited by karldmoore; Aug 29th, 2007 at 10:26 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  4. #14
    Join Date
    Sep 2006
    Posts
    21

    Default

    Andreas Senft: I tried that too, still the same problem.

    karldmoore: I removed all the other proprieties. what testOnBorrow is?

    What should I do next? Have I done something wrong?
    Maybe, someone can give me a small project (that only interogates a DB) to see how it behaves.
    I really don't know what should I do next.

    Adrian

  5. #15
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Is it possible you can post what you have?
    Last edited by karldmoore; Aug 29th, 2007 at 10:26 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  6. #16
    Join Date
    Sep 2006
    Posts
    21

    Default

    karldmoore: well...nothing has changed. PLease have a look at my first post in this topic. There are my configurations.

    I am 100% this problems is because of the "idle period". I created a thread in the app that interogates the DB once at 30 minutes, and in this way everything is OK.

  7. #17
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Quote Originally Posted by tarjoadi View Post
    karldmoore: well...nothing has changed. PLease have a look at my first post in this topic. There are my configurations.
    If nothing has changed that would explain the problem . I thought you'd been playing with testOnBorrow and testWhileIdle, also I thought you'd extracted the dataSource configuration to a standalone dataSource.

    Quote Originally Posted by tarjoadi View Post
    I am 100% this problems is because of the "idle period". I created a thread in the app that interogates the DB once at 30 minutes, and in this way everything is OK.
    Indeed, so the connection must be timing out. This is supposed to be why there are "test" settings on the connection pool.
    Last edited by karldmoore; Aug 29th, 2007 at 10:26 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  8. #18
    Join Date
    Sep 2006
    Posts
    21

    Default

    karldmoore: sorry...besides my first configuration, I usd the below bean in my xxx-servlet.xml file :

    <bean id="DataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost/telefon"/>
    <property name="username" value="root"/>
    <property name="password" value="XXXX"/>
    <property name="testWhileIdle" value="true"/>
    <property name="validationQuery" value="select 1 from dual"/>
    <property name="maxWait" value="60000"/>
    <property name="maxActive" value="50"/>
    </bean>

    This is all. I didn't configurate anything. As you see I didn't use testOnBorrow but only testWhileIdle.
    What do you think ? What could be the problem?

    10x

  9. #19
    Join Date
    Sep 2006
    Posts
    21

    Default

    P.S. Do I really have to use this query?
    "select 1 from dual"

    I don't have a dual table, so I think I should change it

    10x

  10. #20
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I think you just seen a simple SQL query that will execute quickly. As for testWhileIdle or testOnBorrow try both of the options and see if either helps.
    Last edited by karldmoore; Aug 29th, 2007 at 10:26 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •