Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Weird problem when using connection pool

 
Mike Sven
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've encountered one problem when using weblogic connection pool by data source. I'm trying to use that connection to insert record but if using connection pool, when calling preparedStatementexecute(), it will throw unique constraint for PK of that table, although actually only insert 1 record. However if using direct jdbc connection, the record can be inserted. Is it due to some statement cache on connection pool side or something else?...really confused for this case.
Thanks a lot for any help or hint from you masters.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"boyofsea " please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.
 
ken zhu
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike Sven,

could you paste your relevant sourcecode and DB & APP server version?
 
Mike Sven
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually there are two things in this case. First of all it is basic issue. The record was inserted at the first time, but could not be retrieved due to format of date, so after run app at the second time(with same data) it threw exception. In some other env, it only insert "dd/MM/yyyy", but in current testing env, its format is "dd/MM/yyyy hh:mi:ss". Secondly, in source code it has such line: pstmt.setTimeStamp((Timestamp)value); that is working with JDBC direct connection(only insert date without time), but after changing to use pool, the default format looks changed, so have to use: pstmt.setDate(j+1, new java.sql.Date(((Timestamp)value).getTime())); to only insert date. Have you encountered such case before?
 
John Kimball
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which database/DBMS?

Edit: And is your pool using the same exact JDBC driver (version, etc.) as your direct-connection test?
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic