File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Weird problem when using connection pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Weird problem when using connection pool" Watch "Weird problem when using connection pool" New topic

Weird problem when using connection pool

Mike Sven

Joined: Nov 14, 2002
Posts: 2
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

Joined: Jun 06, 2007
Posts: 2851

"boyofsea " please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.

|Asking Good Questions|
ken zhu

Joined: Apr 09, 2009
Posts: 20
Mike Sven,

could you paste your relevant sourcecode and DB & APP server version?
Mike Sven

Joined: Nov 14, 2002
Posts: 2
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

Joined: Apr 13, 2009
Posts: 96
Which database/DBMS?

Edit: And is your pool using the same exact JDBC driver (version, etc.) as your direct-connection test?
I agree. Here's the link:
subject: Weird problem when using connection pool
It's not a secret anymore!