-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: when i use c3p0 for connection provider i can't operate db
PostPosted: Sun Feb 20, 2005 11:57 pm 
Newbie

Joined: Mon May 10, 2004 9:14 pm
Posts: 12
my db is oracle 9i ,when i use c3p0 for connection provider i can't update and insert the table record. but i use the hibernte defaut connection pool ,there is nothing error. here is the test code.
Code:
   
Session s = HibernateUtil.currentSession();
     net.sf.hibernate.Transaction t = null;
     try {
      t = s.beginTransaction();
     RLable rlable = new RLable();
     rlable.setId("sdfsd5f");
     rlable.setName("hello");
     rlable.setAdlinks("sdfsdf");
     s.save(rlable);
     s.flush();
     t.commit();

here is the exceptions:
Hibernate: insert into rlable (name, rdesc, isend, isallowcomment, checkswitch, contenturl, flashlink, adlinks, pid, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Problem with checked-in Statement, discarding.
java.lang.NullPointerException
at oracle.jdbc.dbaccess.DBData.clearItem(DBData.java:431)
at oracle.jdbc.dbaccess.DBDataSetImpl.clearItem(DBDataSetImpl.java:3528)
at oracle.jdbc.driver.OraclePreparedStatement.clearParameters(OraclePreparedStatement.java:3401)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.refreshStatement(GooGooStatementCache.java:452)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.checkinStatement(GooGooStatementCache.java:138)
at com.mchange.v2.c3p0.impl.C3P0PooledConnection$1$WrapperStatementHelper.doClose(C3P0PooledConnection.java:429)
at com.mchange.v2.c3p0.impl.C3P0PooledConnection$2.close(C3P0PooledConnection.java:476)
at net.sf.hibernate.impl.BatcherImpl.closePreparedStatement(BatcherImpl.java:262)
at net.sf.hibernate.impl.BatcherImpl.closeStatement(BatcherImpl.java:136)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:125)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2367)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at com.rsys.rsys.dao.RLableDAO.main(RLableDAO.java:44)
java.lang.RuntimeException: Internal inconsistency: A (not new) checking-out statement is not in deathmarch.
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.undeathmarchStatement(GooGooStatementCache.java:437)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.removeStatement(GooGooStatementCache.java:273)
at com.mchange.v2.c3p0.stmt.GooGooStatementCache.checkinStatement(GooGooStatementCache.java:146)
at com.mchange.v2.c3p0.impl.C3P0PooledConnection$1$WrapperStatementHelper.doClose(C3P0PooledConnection.java:429)
at com.mchange.v2.c3p0.impl.C3P0PooledConnection$2.close(C3P0PooledConnection.java:476)
at net.sf.hibernate.impl.BatcherImpl.closePreparedStatement(BatcherImpl.java:262)
at net.sf.hibernate.impl.BatcherImpl.closeStatement(BatcherImpl.java:136)
at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:125)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2417)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2367)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
at com.rsys.rsys.dao.RLableDAO.main(RLableDAO.java:44)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 4:07 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
Hi.

This is a bug in older versions of Oracle's JDBC driver that broke PreparedStatement caching in most Connection pools.

The workaround is to upgrade to a later Oracle driver that fixes the problem, or turn PreparedStatement caching off (for hibernate+c3p0, set hibernate.c3p0.max_statements to 0).

For more, see...

http://forum.hibernate.org/viewtopic.php?t=928603
http://forum.hibernate.org/viewtopic.php?t=938805
http://forum.hibernate.org/viewtopic.php?t=934050

smiles,
Steve (c3p0 guy)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 4:18 am 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
(Also, you might consider upgrading to a more recent version of c3p0. The RuntimeException that occurs in your stack trace after clearParameters() fails was a c3p0 issue, but it was fixed long ago... That issue won't bite once you get beyond the clearParameters() bug, but there are lots of other improvements and fixes in newer c3p0s.)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2005 8:51 pm 
Newbie

Joined: Mon May 10, 2004 9:14 pm
Posts: 12
swaldman
smiles,
Steve (c3p0 guy)
thank you


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.