This configuration cannot be modified in the database Server side, because it needs to be configured in the application system side. Second, the solution Through access to the data source and mybatis related source code, there are two ways to support changes: 1, use the Druid connectionInitSqls data source configuration items defined connection initialization statement: connectionInitSqls: [“ALTER SESSION SET NLS_LANGUAGE=’AMERICAN'”] ALTER SESSION SET NLS_LANGUAGE=’AMERICAN’ @configuration public class myBatisPlusConfig {@configuration public class myBatisPlusConfig {@configuration public class myBatisPlusConfig {

/** * change session state ** @Bean public update update () {return new AlterSessionInterceptor(); } / optimistic locking plug-in * * * * * @ return * / @ Bean public CustomOptimisticLockerInterceptor optimisticLockerInterceptor () {return new CustomOptimisticLockerInterceptor(); } /** * Oracle Sequence primary key ** @return */ @bean public oracleKeyGenerator() {return new OracleKeyGenerator(); }

}

(2) Interceptor code: @Slf4j @Intercepts({@Signature(type = StatementHandler.class, method = “prepare”, args = {Connection.class, Integer.class})}) public class AlterSessionInterceptor implements Interceptor {

@Override
public Object intercept(Invocation invocation) throws Throwable {
    Object[] args = invocation.getArgs();
    Connection connection = (Connection) args[0];
    if ("Oracle".equalsIgnoreCase(connection.getMetaData().getDatabaseProductName())) {
        Statement statement = null;
        try {
            statement = connection.createStatement();
            String locale = RequestHelper.getCurrentLocale();
            if ("en_GB".equalsIgnoreCase(locale)) {
                statement.execute("ALTER SESSION SET NLS_LANGUAGE='AMERICAN'");
            } else {
                statement.execute("ALTER SESSION SET NLS_LANGUAGE='SIMPLIFIED CHINESE'");
            }
        } finally {
            statement.close();
        }
    }
    return invocation.proceed();
}

@Override
public Object plugin(Object target) {
    if (target instanceof StatementHandler) {
        return Plugin.wrap(target, this);
    }
    return target;
}

@Override
public void setProperties(Properties properties) {
    // to do nothing
}

3, 1, the data source configuration scheme comparison, one-time configuration, need not modify the code, all users all see error messages are in English 2, in the code to intercept processing, need to modify the code, for different users according to different language versions of the error message, but every time, when performing a statement needs to execute a set language version of the statement, The operation is cumbersome and affects the performance