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 multiple threads for database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: multiple threads for database
It's not a secret anymore!