>>>>> Steinar Bang <s...@dod.no>:

> I am trying to write the derby database to a derby network server, and
> that doesn't work well:
>  java.lang.ClassCastException: org.apache.derby.jdbc.ClientDriver cannot be 
> cast to org.apache.derby.jdbc.InternalDriver
>       at org.apache.derby.jdbc.BasicEmbeddedDataSource40.findDriver(Unknown 
> Source)
>       at 
> org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.createPooledConnection(Unknown
>  Source)
>       at 
> org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource.getPooledConnection(Unknown
>  Source)
>       at 
> no.priv.bang.ukelonn.bundle.db.test.UkelonnDatabaseProviderTest.addUkelonnSchemaAndDataToDerbyServer(UkelonnDatabaseProviderTest.java:296)

> Is the problem that I'm trying to use both a in-memory and a network
> client from the same process?

No, the problem was that I tried to use the OPS4J DerbyDataSourceFactory
to create a connection for a derby client JDBC URL[1], and the
DerbyDataSourceFactory can't do that, because it creates a derby
EmbeddedDataSource[2].

And an EmbeddedDataSource can't create a client connection.  That's why
things failed.

So let the test create a client connection using the regular API[3], and
then the test ran fine, and was able to output the liquibase stuff to a
running derby container.

References:
[1] 
<https://github.com/steinarb/ukelonn/blob/f3c8bf2c3cadb931cce414f1619be39b4e44711e/ukelonn.bundle.db.test/src/test/java/no/priv/bang/ukelonn/bundle/db/test/UkelonnDatabaseProviderTest.java#L293>
[2] 
<https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-derby/src/main/java/org/ops4j/pax/jdbc/derby/impl/DerbyDataSourceFactory.java#L41>
[3] 
<https://github.com/steinarb/ukelonn/blob/scratch/derby-test-writing-to-network-server/ukelonn.bundle.db.test/src/test/java/no/priv/bang/ukelonn/bundle/db/test/UkelonnDatabaseProviderTest.java#L284>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to