Description: You may be sharing a Connection among multiple threads because you have experienced poor concurrency using separate transactions.

# Multi-thread programming tips

You may be sharing a Connection among multiple threads because you have experienced poor concurrency using separate transactions.

Here are some tips for increasing concurrency:

- Use row-level locking.
- Use the TRANSACTION_READ_COMMITTED isolation level.
- Avoid queries that cannot use indexes; they require locking of all the rows in the table (if only very briefly) and might block an update.

In addition, some programmers might share a statement among multiple threads to avoid the overhead of each thread's having its own. Using the single statement cache, threads can share the same statement from different connections. For more information, see in Tuning Java DB.

Parent topic: Working with multiple threads sharing a single connection
Related concepts
Pitfalls of sharing a connection among threads
Related reference
Example of threads sharing a statement