Hi Stefan,
Just specify the DB_LOCALE and CLIENT_LOCALE environment variables in the url.
I used Brian's code for testing. Please refer to the post below.
http://www.hcl-informix-user.com/blogs/introducing-hcl-informix-smart-triggersBelow is what I tested.
1. Check database locale
[informix@db2 skjeong]$ echo "select * from sysdbslocale where dbs_dbsname in ('sysadmin','bank')" | dbaccess sysmaster
Database selected.
dbs_dbsname sysadmin
dbs_collate en_US.819
dbs_dbsname bank
dbs_collate en_US.57372
2 row(s) retrieved.
2. Running java program without locale environment variables
[informix@db2 skjeong]$ head -10 SmartTrigger.java
...
try(IfxSmartTrigger trigger = new IfxSmartTrigger("jdbc:informix-sqli://xxx.xx.xx.xx:53331/sysadmin:user=informix;password=password");) {
[informix@db2 skjeong]$ export CLASSPATH=/work1/informix/1210FC10/jdbc/lib/ifxjdbc.jar:/work1/informix/ids1410fc3/skjeong/gson-2.8.2.jar:.
[informix@db2 skjeong]$ javac SmartTrigger.java
[informix@db2 skjeong]$ java SmartTrigger
Exception in thread "main" java.sql.SQLException: Error executing table registration
at com.informix.smartTrigger.IfxSmartTrigger.watch(IfxSmartTrigger.java:539)
at SmartTrigger.main(SmartTrigger.java:13)
Caused by: java.sql.SQLException: Error executing task pushdata register: Cannot open database bank, error code -1 sql error -23197 isam error 0
at com.informix.smartTrigger.IfxSmartTrigger.registerTriggers(IfxSmartTrigger.java:482)
at com.informix.smartTrigger.IfxSmartTrigger.watch(IfxSmartTrigger.java:536)
... 1 more
3. Running java program after setting locale environment variable
[informix@db2 skjeong]$ head -10 SmartTrigger.java
...
try(IfxSmartTrigger trigger = new IfxSmartTrigger("jdbc:informix-sqli://xxx.xx.xx.xx:53331/sysadmin:user=informix;password=password;DB_LOCALE=en_us.utf8;CLIENT_LOCALE=en_us.utf8");) {
[informix@db2 skjeong]$ /work1/informix/ids1410fc3/jvm/jre/bin/java SmartTrigger
Bank Account Ping!
-- No balance issues
Bank Account Ping!
-- No balance issues
Bank Account Ping!
-- Bank Account Alert detected!
{"operation":"delete","table":"account","owner":"informix","database":"bank","label":"bank_alert_1","txnid":1421638541952,"operation_owner_id":1001,"operation_session_id":544,"commit_time":1587602769,"op_num":1,"restart_logid":331,"restart_logpos":4211028,"rowdata":{"id":22,"name":"John Doe","balance":-23.4499999999999990}}
------------------------------
SangGyu Jeong
Software Engineer
Infrasoft
Seoul Korea, Republic of
------------------------------
Original Message:
Sent: Wed April 22, 2020 03:42 AM
From: Stefan Wilfling
Subject: Using IfxSmartTrigger on utf8 database
Hi!
I currently test the Smarttrigger-Feature.
Tested at DB-VERSION=14.10.FC3, JDBC-VERSION=4.50.JC3.
I use the following code:
IfxSmartTrigger trigger = new IfxSmartTrigger(triggerURL, properties);
trigger.addTrigger("tablexy", "informix", database, "SELECT id FROM tablexy", new SmartTriggerNotify());
trigger.watch();
When i use the testdatabase as "triggerURL", I get:
java.sql.SQLException: Routine (task) can not be resolved.
When I use the sysadmin-Database as "triggerURL", I get:
SQLException: Error executing task pushdata register: Cannot open database testdb, error code -1 sql error -23197 isam error 0
ErrorCode -23197: -23197 Database locale information mismatch.
So the first question is:
What is the correct database for the SmartTrigger-Initialization? sysadmin or the real database?
Thanks for your answers!
------------------------------
Kind Regards
Stefan
------------------------------
#Informix