wood burning stoves
The moose likes JDBC and Relational Databases 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 and Relational Databases
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: 124
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: http://aspose.com/file-tools
subject: multiple threads for database
jQuery in Action, 3rd edition