0
votes

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 ?

2
you tagged different RDBMS products . Each may have a different method , or not require any connection setting at all (e.g. Db2-LUW).mao
More confusingly you tag [sql-server] and [db2] but your code says MySQL. I've removed the tags as they don't appear to match the question. Edit your question and tag the RDBMS you are really using and only that RDBMS.Larnu
I'd ask if it's even related to the SQL language...jarlh
Which dbms are you using?!?jarlh
DB :SQL server , Code : Java Open JPA, server : websphereRaghaven

2 Answers

0
votes

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://docs.microsoft.com/en-us/sql/connect/jdbc/setting-the-connection-properties?view=sql-server-ver15

0
votes

If the database supports setting the property "characterEncoding", you can simply create a custom datasource property for it, with the value you need. If the database supports supports url connection (as in your example), you can also just include it as part of your connection URL, which can also be set as a custom datasource property.