In my program I create several thread. Each thread holds a database connection, it means, each thread instantiates the "database" class which allows them to work with the database.

When the first thread is "run", then all queries to the database work fine. When the second thread in "run", then all queries to the database work too, but the first thread cannot use the database anymore.

1. Is this a correct approach of having each thread a connection to the database, or should I have a general instance of a "database" and have each thread use it ?

2. If it is correct to have each thread with an instance of the "database", what could be wrong ?