You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by ivan nemeth <iv...@forumdigital.net> on 2014/08/01 16:44:02 UTC

Best practice to access a DbDatabase?

Hi,

a month ago (June 2014) there was a discussion already about connection
pooling but I have further questions. I use some kind of connection pooling
and Spring's JdbcTemplate, so I have a separate connection for each
threads. But how should I access a DbDatabase instance? The db instance is
tied to the actual connection, so separate threads can't use the same db
instance.

1. Create a new DbDatabase instance for every query/updates/insert. Can it
cause any problems, if a lot of instances are created every second? I mean
there are static variables which are storing some global states
(DbDatabase.databaseMap, DbTable.tableCount etc.)

2. Use some kind of pooling on the DbDatabase.

Thanks,
Ivan