0

SymmetricDS helpfully provides a snippet of code to run a basic node from Java. No context is provided, however, and there is no compilable example in their github repository.

This other user's example gets a little closer, but still fails for me at getcEngine().openRegistration(...) with exception:

java.lang.IllegalStateException: This node has not been configured.Could not find a row in the identity table

Have you successfully run an embedded client with version 3.8? Can you provide a minimal example that gets past the setup stage?

Community
  • 1
  • 1
Autumn
  • 3,214
  • 1
  • 20
  • 35
  • Have you tried inserting in the db manually via sql insert script the identity of the node? – Boris Pavlović Feb 22 '17 at 08:48
  • 2
    Thanks Boris! Just discovered that late last night, and it seems to have made things work. I'm just working up my example to post here. – Autumn Feb 22 '17 at 17:02

1 Answers1

0

The linked examples actually do work, but an embedded client does not have its node database set up for you. At a minimum, you need a sym_node and sym_node_identity row for this client. The SQL below works for me.

Also, here's a minimum compilable example for IntelliJ Idea with a scripted demo of symmetricDS 3.8.16.

CREATE TABLE "sym_node"(
    "node_id" VARCHAR NOT NULL PRIMARY KEY ,
    "node_group_id" VARCHAR NOT NULL,
    "external_id" VARCHAR NOT NULL,
    "sync_enabled" INTEGER DEFAULT 0,
    "sync_url" VARCHAR,
    "schema_version" VARCHAR,
    "symmetric_version" VARCHAR,
    "database_type" VARCHAR,
    "database_version" VARCHAR,
    "heartbeat_time" TIMESTAMP,
    "timezone_offset" VARCHAR,
    "batch_to_send_count" INTEGER DEFAULT 0,
    "batch_in_error_count" INTEGER DEFAULT 0,
    "created_at_node_id" VARCHAR,
    "deployment_type" VARCHAR
);

CREATE TABLE "sym_node_identity"(
    "node_id" VARCHAR NOT NULL PRIMARY KEY ,
    FOREIGN KEY ("node_id") REFERENCES "sym_node" ("node_id")
);

insert into sym_node (node_id,node_group_id,external_id,sync_enabled,sync_url,schema_version,symmetric_version,database_type,database_version,heartbeat_time,timezone_offset,batch_to_send_count,batch_in_error_count,created_at_node_id) 
 values ('003','store','003',1,null,null,null,null,null,current_timestamp,null,0,0,'000');

INSERT INTO "sym_node_identity" VALUES('003');
Autumn
  • 3,214
  • 1
  • 20
  • 35