Hi thank you for reading my post what will happen if i use a connection object in several threads ? and perform insert/delete oprtaion in that thread ? will my data lost or currept ? should i change the autocommit or transaction level stuff ?
You should definitely not use a Connection object in more than one thread simultaneously. You're right that transaction issues would need to be considered, so unless you can guarantee that those aren't an issue, and are also sure that the threads won't access the Connection simultaneously, you shouldn't share it.
Joined: Jul 14, 2005
Hi Thank you for reply. What about readonly use of a connection in several threadds? if i just need to read some data from database in multiple threads will it harm my application if i use a single connection in all those reader thread ?
Joined: Mar 22, 2005
Read-only access may be OK, although it may not work if two threads issue commands at the same time. The behavior might be database-dependent, too (i.e., some drivers or databases may support this, while others may not).