Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [kapua-dev] Using the KapuaLiquibaseClient with an external H2 database

Hi Jean-Baptiste,


    before going into more details about the context, I would try with setting the following system variables at the JVM level:


-Dcommons.db.schema.update=true

-Dcommons.db.connection.host=<your-host> (e.g. 127.0.0.1)

-Dcommons.db.connection.port=3306 


they override the defaults in the kapua-environment-setting.properties file, other defaults are usually ok (i.e. if you don't need specific schema names). Sometimes this is enough to let it start successfully but it depends on the your application setup.

S


From: kapua-dev-bounces@xxxxxxxxxxx <kapua-dev-bounces@xxxxxxxxxxx> on behalf of Jean-Baptiste Trystram <jbtrystram@xxxxxxxxxx>
Sent: Thursday, November 22, 2018 4:47:02 PM
To: kapua-dev@xxxxxxxxxxx
Subject: [kapua-dev] Using the KapuaLiquibaseClient with an external H2 database
 
Hello,

I am trying to use the Kapua Device Registry engine to implement the Hono Device registry API. In order to to that I used the original work of Dejan B. that you can find here.
I have a small PoC application working and I want to have this running in the proper docker way, i.e. splitting the application between several containers.

In order to do that I need to use the liquibase client to connect to an external database, accessible through the network.
I've been playing a little bit with the client and there is an issue when I tried to set the Jdbc URL to an external server.
The issue is that the LiquibaseClient will try to create "DATABASECHANGELOG" multiple times.

Here is my test scenario :
Running the H2 database in another JVM : java -cp h2-1.4.197.jar org.h2.tools.Server
create the database with
CREATE SCHEMA IF NOT EXISTS KAPUA;

Then in https://github.com/eclipse/kapua/blob/develop/service/liquibase/src/test/java/org/eclipse/kapua/service/liquibase/KapuaLiquibaseClientTest.java, replacing "jdbc:h2:mem:kapua;MODE=MySQL" with "jdbc:h2:tcp://localhost:9092/~/kapua;MODE=MySQL" and specify the correct username when needed.

Then, if I run the tests with mvn verify (from the directory kapua/service/liquibase/ ), the tests fails :
[main] ERROR o.e.k.s.l.KapuaLiquibaseClient - Error while running Liquibase scripts!
liquibase.exception.DatabaseException: Table "DATABASECHANGELOG" already exists;

I have atached the full output to this email. Some bits are in french sorry, But they are bot duplicates of the english errors.

Is that expected ? How can we get the liquibase client to play nice with an external H2 instance ?
I'm happy to provide more details if you need!

btw, you can have a look at this device registry project here, any feedback is welcome ! :)

Thanks,
Jean-Baptiste Trystram

Back to the top