use of com.j256.ormlite.jdbc.JdbcPooledConnectionSource in project IPK-BrAPI-Validator by plantbreeding.
the class AppServletContextListener method createDatabaseConnection.
private static void createDatabaseConnection(ServletContext servletContext) {
String path = Config.get("dbpath");
String databaseUrl = path;
ConnectionSource connectionSource;
try {
connectionSource = new JdbcPooledConnectionSource(databaseUrl);
((JdbcPooledConnectionSource) connectionSource).setUsername(Config.get("dbuser"));
((JdbcPooledConnectionSource) connectionSource).setPassword(Config.get("dbpass"));
if (connectionSource.getDatabaseType().getClass().equals(com.j256.ormlite.db.OracleDatabaseType.class)) {
Cache.addToCache("dbType", "oracle");
} else {
Cache.addToCache("dbType", "other");
}
DataSourceManager.setConnectionSource(connectionSource);
} catch (SQLException e) {
e.printStackTrace();
}
}
Aggregations