Unable to fetch/insert strings in a foreign language using JDBC activity.

Unable to fetch/insert strings in a foreign language using JDBC activity.

book

Article ID: KB0093549

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Description:
While Inserting regional/foreign languages text strings in the MySql DB, question marks are seen or boxes being inserted using the JDBC Update activity. If inserting the text in MySqlWorkbench directly, the data can be read correctly in the JDBC Query activity.


Issue/Introduction

Unable to fetch/insert strings in a foreign language using JDBC activity.

Resolution

1).Check the encoding on the DB side using the following query:

SELECT * FROM information_schema.SCHEMATA S where SCHEMA_NAME = "<schema_name>";


The encoding and collation values must be UTF-8.


2).Check if the project level encoding on BW side is UTF-8.


3). Add the following in the Designer/application.tra file:

java.property.file.encoding=UTF-8
java.property.sun.jnu.encoding=UTF-8
java.extended.properties=-Dfile.encoding=UTF-8

4). Append this to the JDBC connection string: ?useUnicode=yes&characterEncoding=UTF-8

e.g.: jdbc:mysql://localhost:3306/<schema_name>?useUnicode=yes&characterEncoding=UTF-8

You can also use: ?logger=StandardLogger&profileSQL=true  This will provide additional tracing in the console logs.

e.g.: jdbc:mysql://support1-dt:3306/db_schema?logger=StandardLogger&profileSQL=true