private DatabaseConnection createDatabaseConnection(final String dbName) throws Exception { DatabaseConnection dbConnection = new DatabaseConnection(); dbConnection.setName(dbName); dbConnection.setHostname(EXP_DBMETA_HOSTNAME); dbConnection.setDatabaseType(mockDatabaseType("Hypersonic")); dbConnection.setAccessType(DatabaseAccessType.NATIVE); dbConnection.setDatabasePort(EXP_DBMETA_PORT); return dbConnection; }
public void testCreatePool() throws Exception { final ObjectFactory objectFactory = ClassicEngineBoot.getInstance().getObjectFactory(); final IDatabaseDialectService dialectService = objectFactory.get(IDatabaseDialectService.class); final DatabaseTypeHelper databaseTypeHelper = new DatabaseTypeHelper(dialectService.getDatabaseTypes()); final DatabaseConnection con = new DatabaseConnection(); con.setId("Memory"); con.setName("Memory"); con.setAccessType(DatabaseAccessType.NATIVE); con.setDatabaseType(databaseTypeHelper.getDatabaseTypeByShortName("GENERIC")); con.setUsername("pentaho_user"); con.setPassword("password"); final HashMap<String, String> attrs = new HashMap<String, String>(); attrs.put(DatabaseConnection.ATTRIBUTE_CUSTOM_DRIVER_CLASS, "org.hsqldb.jdbcDriver"); attrs.put(DatabaseConnection.ATTRIBUTE_CUSTOM_URL, "jdbc:hsqldb:mem:SampleData"); con.setAttributes(attrs); final PoolingDataSource poolingDataSource = PooledDatasourceHelper.setupPooledDataSource(con); final Connection connection = poolingDataSource.getConnection(); connection.close(); }
private void updateDatabaseConnection(DatabaseConnection dbConnection) throws Exception { dbConnection.setHostname(EXP_UPDATED_DBMETA_HOSTNAME); dbConnection.setDatabaseType(mockDatabaseType("Generic database")); dbConnection.setAccessType(DatabaseAccessType.JNDI); dbConnection.setDatabasePort(EXP_UPDATED_DBMETA_PORT); }