Search code examples
sql-serverjdbcwebspherejndiwebsphere-8

Websphere Data source UTF8 connection parameter


I have to define the UTF8 character encoding connection parameter in the websphere JDBC datasource settings.

I didn't find any option to configure the connection parameter

?useUnicode=yes&characterEncoding=UTF-8

Eg: jdbc:sqlserver://localhost/DatabaseName?useUnicode=yes&characterEncoding=UTF-8

Is there any way to configure the characterEncoding connection parameter in the Websphere JDBC data source ?


Solution

  • The closest setting that I see on the Microsoft SQL Server JDBC driver is sendStringParametersAsUnicode with values of true or false, which appears to be a way of getting PreparedStatement.setString and a few other methods to supply parameters to the database as unicode prior to the introduction of methods such as PreparedStatement.setNString in JDBC 4.0, which would always use unicode.

    https://learn.microsoft.com/en-us/sql/connect/jdbc/setting-the-connection-properties?view=sql-server-ver15