Menu

#369 Easy way to add file

open
nobody
None
5
2024-06-23
2024-06-22
No

I am not sure, from where i can get the support!

So, I am trying to use SymmetricDS with HSQLDb and MySQL. I am trying to run hsqldb as Server mode from Java codding, I am not sure, how can I add the classpath of symmetric-client-3.15.7.jar when running hsqldb, as it's not picking up by simpley running!

I alreday hava added symmetricds dependencies in my build.gradle file.

HsqlProperties p1 = new HsqlProperties();
p1.setProperty("server.database.0", "mem:hsqldb");
p1.setProperty("server.dbname.0", "minicogs");
p1.setProperty("server.port", "9001");
p1.setProperty("server.remote_open", "true");
server1 = new Server();
server1.setProperties(p1);
server1.setLogWriter(null);
server1.setErrWriter(null);
server1.start();

in cmd, i can simpley run

java -cp"lib/hsqldb-2.5.1.jar;web/WEB-INF/lib/symmetric-client-3.15.7.jar" org.hsqldb.Server --address %SERVER_ADDRESS% --port %SERVER_PORT% --database.0 "%DB_PATH%;%DB_ENCRYPT%;user=%DB_USER%;password=%DB_PASSWORD%" --dbname.0 %DB_NAME%

but not sure, how can i set classpath when trying to run HSQLdb server through my java code!

then problem is that when i try to run this function, I am facing the error:

CREATE FUNCTION sym_base_64_encode(binaryData BINARY)
RETURNS VARCHAR(1000000)
NO SQL
LANGUAGE JAVA PARAMETER STYLE JAVA
EXTERNAL NAME > 'CLASSPATH:org.jumpmind.symmetric.db.hsqldb.HsqlDbFunctions.encodeBase64';

SQL Error [42501]: user lacks privilege or object not found: org.jumpmind.symmetric.db.hsqldb.HsqlDbFunctions

Discussion

  • Fred Toussi

    Fred Toussi - 2024-06-22

    You need to tell HSQLDB that it is OK to use the HsqlDBFunctions class from symmertic. You do this by adding a -D switch to the java command.

    java -Dhsqldb.method_class_names="org.jumpmind.symmetric.db.hsqldb.*" cp"lib/...
    

    See the Guide: http://hsqldb.org/doc/2.0/guide/sqlroutines-chapt.html#src_jrt_access_control

    Please also use the latest version of HSQLDB.

     
  • Abid Maqbool

    Abid Maqbool - 2024-06-23

    @fredt thanks for your quick reply! Your porvided solutions works like a charm!
    I like HSQLdb super community support!

    java -Dhsqldb.method_class_names="org.jumpmind.symmetric.db.hsqldb.*" -cp "hsqldb-2.7.3.jar;symmetric-client-3.15.7.jar" org.hsqldb.server.Server --database.0 file:mydb --dbname.0 xdb

     

    Last edit: Abid Maqbool 2024-06-23

Log in to post a comment.

MongoDB Logo MongoDB