Session variables not recognized
I'm currently trying to set the sql_mode of my MySQL connection to NO_ENGINE_SUBSTITUTION (only) using the sessionVariables field in Data Sources and Drivers > Advanced. Hereby I'm using the following as value: sql_mode='NO_ENGINE_SUBSTITUTION'.
Unfortunately this setting doesn't seem to be recognized. In my particular test case I created a new procedure after saving the settings and reconnecting to my db, checking if the mysql.proc table is showing the correct value in column sql_mode for that procedure.
Result:
STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
Which I assume is the default, because it looked the same before my changes. In my case I want to explicitly turn off STRICT_TRANS_TABLES though.
I also tried 'sql_mode=NO_ENGINE_SUBSTITUTION' and sql_mode=NO_ENGINE_SUBSTITUTION (different quotations), but nothing worked.
Please help, this issue is rendering the software practically useless for me.
Please sign in to leave a comment.
@Sebastian Haesener
Could you specify your MySQL server and driver version?
I can't reproduce the issue:
According to documentation https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_db2 it works correctly.
Make sure you have no errors in Event Log and there are no spaces in value.
Hi Vasily,
I'm using MySQL 5.7.22 and the latest MySQL Driver (jdbc 5.1.46).
Below you see a screenshot of my advanced connection settings:
Using a combination sql mode like you did with DB2 is not an option for me, especially since most of these - including DB2 - are deprecated as of MySQL 5.7.22.
The expected behaviour of the software based on above settings should be something like:
Instead I see the following result:
On the right you can clearly see, that the software somehow added STRICT_TRANS_TABLES. In fact, no matter what I set the sql_mode to (via sessionVariables) Datagrip always adds STRICT_TRANS_TABLES.
And just to be 100% clear: I'm using the latest version of Datagrip and there's no errors in the event log nor any spaces in value.
@Sebastian Haesener
According to MySQL Connector/J bugtracker https://bugs.mysql.com/bug.php?id=23371 it works as intended:
If to look through MySQL documentation https://dev.mysql.com/doc/connectors/en/connector-j-reference-configuration-properties.html one can find the following:
So, one needs to configure Advanced options properly to get the desired result:
Hi Vasily,
thanks a lot for pointing that out that tiny but important detail, it resolved the issue for me.