This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiple threads for database

 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use only local variables for thread-safety.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic