catch (SQLException exception) {
throw new MDatabaseConnectionFailureException("Could not get database connection.", exception);
}
- // Set SQL mode to standard ANSI and TRADITIONAL.
- try {
- this.getConnection().createStatement().executeUpdate("SET SQL_MODE = 'ANSI,TRADITIONAL'");
+ // Set SQL mode to standard ANSI and TRADITIONAL (MySQL / MariaDB databases only).
+ if (this.getDriver().toLowerCase().matches(".*(mysql|mariadb){1}.*")) {
+ try {
+ this.getConnection().createStatement().executeUpdate("SET SQL_MODE = 'ANSI,TRADITIONAL'");
/* Disabled to prevent an infinite loop.
- this.logStatement("### SET SQL_MODE = 'ANSI,TRADITIONAL' ###");
+ this.logStatement("### SET SQL_MODE = 'ANSI,TRADITIONAL' ###");
*/
- }
- catch (SQLException exception) {
- throw new MDatabaseConnectionFailureException("Could not set SQL mode to ANSI and TRADITIONAL.", exception);
+ }
+ catch (SQLException exception) {
+ throw new MDatabaseConnectionFailureException("Could not set SQL mode to ANSI and TRADITIONAL.", exception);
+ }
}
}