Hi, I'm developing a web application using DbUtils classes to execute
queries and so on.
I user QueryRunner class with a DataSource.
I red this class is thread safe, so I implemented a Singleton to instance
QueryRunner only once.
This is my code:
public class QueryManager {
private static QueryManager queryManager = null;
private static QueryRunner queryRunner = null;
static {
try {
queryRunner = new QueryRunner(DataSourceSingleton.getInstance()
.getDataSource());
} catch (Exception e) {
}
}
public static QueryManager getInstance() {
if (queryManager == null) {
queryManager = new QueryManager();
}
return queryManager;
}
public QueryRunner getQueryRunner() {
return queryRunner;
}
In my servlets I use:
QueryManager.getInstance().getQueryRunner().query(...);
Is this correct?
Which is the best practice to use QueryRunner in a web context?
Thanks a lot in advance
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]