>>>>> Bryan Pendleton <bpendleton.de...@gmail.com>:

> Anyway, yes, please try to figure out if you have any CLASSPATH conflicts,
> and please do let us know the results of your investigations!

The reason for my problems turned out to be quite simple.

I'm using the pax-jdbc DerbyDataSourceFactory in my derby database
bundle, so I was using that class in my unit test as well, assuming it
would be able to create the correct kind of data source, depending on
the JDBC URL.

However, when I looked at the source of the
DerbyDataSourceFactory.createDataSource() method, it looked like this:

    public DataSource createDataSource(Properties props) throws SQLException {
        EmbeddedDataSource ds = new EmbeddedDataSource();
        setProperties(ds, props);
        return ds;
    }

...and an EmbeddedDataSource won't be able to create a client
connection... or so I think...?

So instead I created a client datasource directly, and that worked fine:
        boolean createUkelonnDatabase = true;
        ClientConnectionPoolDataSource dataSource = new 
ClientConnectionPoolDataSource();
        dataSource.setServerName("localhost");
        dataSource.setDatabaseName("ukelonn");
        dataSource.setPortNumber(1527);
        if (createUkelonnDatabase) {
            dataSource.setCreateDatabase("create");
        }
        PooledConnection connect = dataSource.getPooledConnection();

With this connection, Liquibase can do its thing, and set up the schema
and data in the server.

Thanks again!

Reply via email to