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

multiple threads for database

Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 107
I changed a process to multiple threads to read data from DB. the original code works fine. I just change main process to multiple threads with DBPool and keep all DB code without change.

after changed to multiple thread, it throws SQLException as

java.sql.SQLException: ORA-01001: invalid cursor

java.sql.SQLException: Closed Statement: next

Any advices for the change for multiple threads DB access?

[ September 09, 2005: Message edited by: Steve Jiang ]
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Use only local variables for thread-safety.

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
I agree. Here's the link:
subject: multiple threads for database