Reiniel Herrera
Reiniel Herrera

Reputation: 513

SonarQube and Oracle 12C

i'm trying to setup a SonarQube server using the 7.1 docker official image connecting with Oracle 12C 12.2.0.1 database with AL32UTF8 character set. The thing is UTF8 is deprecated in oracle, and instead they use AL32UTF8, that is pretty much the same but with more space to storage data. When trying to start the sonar server and error is been throwing: "web server startup failed: Oracle NLS_CHARACTERSET does not support UTF8: WE8MSWIN1252". I can't find any doc or workarounds to fix this problem. If any have experience this or have any clues will be very helpful. I'm stock with this problem and can't find a solution. Thanks in advance.

Upvotes: 0

Views: 718

Answers (1)

Reiniel Herrera
Reiniel Herrera

Reputation: 513

Finally was able to solve this issue that was tormenting me sometime. Sonarqube perform a verification for ensure the database supports UTF8 encoding:

    private void expectUtf8(Connection connection) throws SQLException {
    String charset = this.getSqlExecutor().selectSingleString(connection, "select value from nls_database_parameters where parameter='NLS_CHARACTERSET'");
    if (!StringUtils.containsIgnoreCase(charset, "utf8")) {
        throw MessageException.of(String.format("Oracle NLS_CHARACTERSET does not support UTF8: %s", charset));
    }
}

If you see the error showed in the question, run this query on your database: **select value from nls_database_parameters where parameter='NLS_CHARACTERSET'** for find out the character set your database have. The value obtained by the previous query is used for check the characterset. In my specific case the result was WE8MSWIN1252, and that's why i was getting that error. So, set the NLS_CHARACTERSET to AL32UTF8 fix the problem. Hope this can help someone out there.

Upvotes: 1

Related Questions