unable to update CLOB using DBCP connection

Am trying to do update a clob column using a connection object that is retrieved using Apache DBCP connection pooling. Earlier, I've implemented connection pooling using [this][1] and it was working fine i.e am able to update CLOB. I switched to DBCP because I was getting *java.sql.SQLException: ORA-01000: maximum open cursors exceeded*. I've checked connection, resultSet, preparedStatement objects in all the DAOs. All the *finally* blocks have these cursors closed. Still am facing this error and so decided to switch to DBCP. But, when I try to update CLOB, with this DBCP connection, the application just hangs at *pstmt.executeUpdate()*. Connection conn = null; PreparedStatement pstmt = null; CLOB clob = null; String q = "UPDATE REPORT_TABLE SET RPT_FILE = ? WHERE RPT_SEQ_NUM = ?"; ... conn = DBConnection.getConnection(); pstmt = conn.prepareStatement(q); clob = getCLOB(xmlReport, conn); pstmt.setObject(1, clob); pstmt.setString(2, reportSeqNo); if (pstmt.executeUpdate() == 1) { logger.logError("Report has been successfully UPDATED"); } ... where getCLOB() method is: private CLOB getCLOB(String xmlData, Connection conn) throws SQLException{ CLOB tempClob = null; try{ // If the temporary CLOB has not yet been created, create new tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION); // Open the temporary CLOB in readwrite mode to enable writing tempClob.open(CLOB.MODE_READWRITE); // Get the output stream to write Writer tempClobWriter = tempClob.getCharacterOutputStream(); // Write the data into the temporary CLOB tempClobWriter.write(xmlData); // Flush and close the stream tempClobWriter.flush(); tempClobWriter.close(); // Close the temporary CLOB tempClob.close(); } catch(SQLException sqlexp){ tempClob.freeTemporary(); sqlexp.printStackTrace(); } catch(Exception exp){ exp.printStackTrace(); tempClob.freeTemporary(); exp.printStackTrace(); } return tempClob; } I've also tried by passing the `((DelegatingConnection) conn).getInnermostDelegate()` connection, but no use. Also, I tried what [Shiny][2] has suggested [here][3]. This time its hanging while I'm selecting the data. Am using Oracle 9i and the JDBC Oracle Driver version is above 10(Sorry, couldn't remember exact version now). [1]: http://java.sun.com/developer/onlineTraining/Programming/JDCBook/conpool.html [2]: https://stackoverflow.com/users/7867/mr-shiny-and-new [3]: https://stackoverflow.com/questions/862355/overcomplicated-oracle-jdbc-blob-handling
Could you show your getCLOB method (and what datatype is "xmlReport"?)?

以上就是unable to update CLOB using DBCP connection 的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏