wood burning stoves 2.0*
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
Author

multiple threads for database

Steve Jiang
Ranch Hand

Joined: May 17, 2004
Posts: 106
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

and
java.sql.SQLException: Closed Statement: next

Any advices for the change for multiple threads DB access?

Thanks,
[ 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
 
Similar Threads
member variables in servlet
A lock could not be obtained within the time requested
on FILE attributes (badly need help)
Multiple Java processes when tomcat starts
help in sql