Skip to content Skip to sidebar Skip to footer

Sqlite Handler Class As Singleton?

I am using SQLite and JAVA. I would like to know if its a good idea to make a singleton SQLite DB handler class. I have a normal SQLite DB handler class but I keep on running into

Solution 1:

If you have a single database, using a singleton is perfectly fine.

A database connection does not interfere with other accesses (as long as no transaction is active), and does not use many resources. Closing the database would just increase the overhead when you need to re-open it.

Post a Comment for "Sqlite Handler Class As Singleton?"