sunmingtao / sample-code

3 stars 4 forks source link

MySQLSyntaxErrorException: You have an error in your SQL syntax #179

Closed sunmingtao closed 4 years ago

sunmingtao commented 4 years ago

Run a banjo script

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE node_history h, sess_node s SET h.txn_end = @txn WHERE h.txn_end = 0 AND ' at line 1
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
sunmingtao commented 4 years ago

The jdbc url I used is jdbc:mysql://mysql-dluat.nla.gov.au:8306/amberdb

But should include allowMultiQueries=true and possibly other params as well.

The correct url is

jdbc:mysql://mysql-dluat.nla.gov.au:8306/amberdb?allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useUnicode=yes&characterEncoding=UTF-8&relaxAutoCommit=true&profileSQL=false&serverTimezone=UTC