DB2 insert UTF-8 characters on non unicode database with ALT_COLLATE UNICODE
I am trying to insert Chinese text in a DB2 Database but not working.
The database is configured by default as ANSI (en_US 819) (and it's a requirement for other applications that use the dame databse) ALT_COLLATE IDENTITY_16BIT is defined and UNICODE tables are created using CCSID UNICODE but unicode characters for Chinese or Korean are not inserted.
Example table:
CREATE TABLE LANGS (
IDIOMA char(2) NOT NULL,
PAIS char(2) NOT NULL,
TRADUC long varchar NOT NULL,
) CCSID UNICODE;
Example insert:
INSERT INTO LANGS (IDIOMA,PAIS,TRADUC) VALUES ('zh','TW','其他');
System Information:
- Server: DB2 9.7 on Ubuntu 64bit (en_US)
- Client: Windows 7 32bit (es_ES) Java 7 with db2jcc.jar
Example Java extract:
Class.forName("com.ibm.db2.jcc.DB2Driver");
...
Properties props = new Properties();
props.setProperty("user", user);
props.setProperty("password", pass);
props.setProperty("DB2CODEPAGE", "1208");
props.setProperty("retrieveMessagesFromServerOnGetMessage", "true");
con = DriverManager.getConnection(url, props);
...
Statement statement = con.createStatement();
statement.execute(sql);
...
statement.close();
con.close();
DB cfg get
DB2 Database locale configuration
Territorio de base de datos = en_US;
Página de códigos de base de datos = 819
Conjunto de códigos de base de datos = iso8859-1
Código de país/región de base de datos = 1
Secuencia de clasificación de base de datos = UNIQUE
Orden de clasificación alternativo (ALT_COLLATE) = IDENTITY_16BIT
Tamaño de página de base de datos = 4096
Statements are executed correctly and rows appears correctly in the database for:
- en_GB
- en_US
- es_ES
- pt_PT
but not for:
- cy_GB
- ko_KR
- zh_TW
Insert from command line with db2cmd also does not work for this languages (Inserts but with only 1 byte.
Insert from command line in a Linux environment localized as zh_TW works.
Insert from command line in a Linux environment localized as en_US.utf-8 works.
Never work on Java on these environments.
Using "X" as prefix form the VARCHAR field is not an option due some restrictions and the SQL works on two environments.
I think it may be some encoding problem on Client, or server due to configuration, file or sql encoding.
Update:
I tried also to load a UTF-8 file with the SQLs. the file loads correctly and debugging the SQL with UTF-8 characters is correctly passed to the Statement but the result is the same.
new InputStreamReader(new FileInputStream(file),"UTF-8")
...
private void executeLineByLine(Reader reader) throws SQLException
StringBuffer command = new StringBuffer();
try
BufferedReader lineReader = new BufferedReader(reader);
String line;
while ((line = lineReader.readLine()) != null)
command = handleLine(command, line);
checkForMissingLineTerminator(command);
catch (Exception e)
String message = "Error executing: " + command + ". Cause: " + e;
printlnError(message);
throw new SQLException(message, e);
private StringBuffer handleLine(StringBuffer command, String line) throws SQLException, UnsupportedEncodingException
String trimmedLine = line.trim();
if (lineIsComment(trimmedLine))
println(trimmedLine);
else if (commandReadyToExecute(trimmedLine))
command.append(line.substring(0, line.lastIndexOf(delimiter)));
command.append(LINE_SEPARATOR);
println(command);
executeStatement(command.toString());
command.setLength(0);
else if (trimmedLine.length() > 0)
command.append(line);
command.append(LINE_SEPARATOR);
return command;
private void executeStatement(String command) throws SQLException, UnsupportedEncodingException
boolean hasResults = false;
Statement statement = connection.createStatement();
hasResults = statement.execute(command);
printResults(statement, hasResults);
statement.close();
Update2:
It's not possible to change the data types. The database is part of other systems and already with data.
The database is installed on 7 different servers on three of it that the data is inserted using Linux in a UTF-8 shell the data was inserted correctly from db2 command line.
From windows db2 command line or using Java it's not possible to insert the characters correctly.
Changing the Java sources to UTF-8 source makes the System.out prints the SQL correctly like i see debugging the sql variable.
When i insert this test SQL. It is shown correctly with chines characters in the System.out and in the Statement internal variable
INSERT INTO LANGS (IDIOMA,PAIS,TRADUC) VALUES ('zh','TW','TEST1 其他 FIN TEST1');
But in the database the test appears as:
TEST3 FIN TEST3
HEX reprentation:
54 45 53 54 33 20 1A 1A 1A 1A 1A 1A 1A 1A 20 46 49 4E 20 54 45 53 54 33
T E S T 3 _ ? ? ? ? ? ? ? ? _ F I N _ T E S T 3
I think that probably DB2 Java client is using allways Windows codepage (in this case is ISO-8859-1 or cp1252) instead of UTF-8 or the server is converting the data using the main collate instead the alternative collate of the table.
Update3:
I installed a Java SQL tool called DbVisualizer and using this tool on windows when a paste in the SQL panel the SQL and run it is inserted correctly in the databse.
This makes me to suspect that is not a problem of installation or data types. Probably are one of this three factors.
- Client configuration
- Server properties sended when client connects
- Driver type of version used
java sql unicode db2
add a comment |
I am trying to insert Chinese text in a DB2 Database but not working.
The database is configured by default as ANSI (en_US 819) (and it's a requirement for other applications that use the dame databse) ALT_COLLATE IDENTITY_16BIT is defined and UNICODE tables are created using CCSID UNICODE but unicode characters for Chinese or Korean are not inserted.
Example table:
CREATE TABLE LANGS (
IDIOMA char(2) NOT NULL,
PAIS char(2) NOT NULL,
TRADUC long varchar NOT NULL,
) CCSID UNICODE;
Example insert:
INSERT INTO LANGS (IDIOMA,PAIS,TRADUC) VALUES ('zh','TW','其他');
System Information:
- Server: DB2 9.7 on Ubuntu 64bit (en_US)
- Client: Windows 7 32bit (es_ES) Java 7 with db2jcc.jar
Example Java extract:
Class.forName("com.ibm.db2.jcc.DB2Driver");
...
Properties props = new Properties();
props.setProperty("user", user);
props.setProperty("password", pass);
props.setProperty("DB2CODEPAGE", "1208");
props.setProperty("retrieveMessagesFromServerOnGetMessage", "true");
con = DriverManager.getConnection(url, props);
...
Statement statement = con.createStatement();
statement.execute(sql);
...
statement.close();
con.close();
DB cfg get
DB2 Database locale configuration
Territorio de base de datos = en_US;
Página de códigos de base de datos = 819
Conjunto de códigos de base de datos = iso8859-1
Código de país/región de base de datos = 1
Secuencia de clasificación de base de datos = UNIQUE
Orden de clasificación alternativo (ALT_COLLATE) = IDENTITY_16BIT
Tamaño de página de base de datos = 4096
Statements are executed correctly and rows appears correctly in the database for:
- en_GB
- en_US
- es_ES
- pt_PT
but not for:
- cy_GB
- ko_KR
- zh_TW
Insert from command line with db2cmd also does not work for this languages (Inserts but with only 1 byte.
Insert from command line in a Linux environment localized as zh_TW works.
Insert from command line in a Linux environment localized as en_US.utf-8 works.
Never work on Java on these environments.
Using "X" as prefix form the VARCHAR field is not an option due some restrictions and the SQL works on two environments.
I think it may be some encoding problem on Client, or server due to configuration, file or sql encoding.
Update:
I tried also to load a UTF-8 file with the SQLs. the file loads correctly and debugging the SQL with UTF-8 characters is correctly passed to the Statement but the result is the same.
new InputStreamReader(new FileInputStream(file),"UTF-8")
...
private void executeLineByLine(Reader reader) throws SQLException
StringBuffer command = new StringBuffer();
try
BufferedReader lineReader = new BufferedReader(reader);
String line;
while ((line = lineReader.readLine()) != null)
command = handleLine(command, line);
checkForMissingLineTerminator(command);
catch (Exception e)
String message = "Error executing: " + command + ". Cause: " + e;
printlnError(message);
throw new SQLException(message, e);
private StringBuffer handleLine(StringBuffer command, String line) throws SQLException, UnsupportedEncodingException
String trimmedLine = line.trim();
if (lineIsComment(trimmedLine))
println(trimmedLine);
else if (commandReadyToExecute(trimmedLine))
command.append(line.substring(0, line.lastIndexOf(delimiter)));
command.append(LINE_SEPARATOR);
println(command);
executeStatement(command.toString());
command.setLength(0);
else if (trimmedLine.length() > 0)
command.append(line);
command.append(LINE_SEPARATOR);
return command;
private void executeStatement(String command) throws SQLException, UnsupportedEncodingException
boolean hasResults = false;
Statement statement = connection.createStatement();
hasResults = statement.execute(command);
printResults(statement, hasResults);
statement.close();
Update2:
It's not possible to change the data types. The database is part of other systems and already with data.
The database is installed on 7 different servers on three of it that the data is inserted using Linux in a UTF-8 shell the data was inserted correctly from db2 command line.
From windows db2 command line or using Java it's not possible to insert the characters correctly.
Changing the Java sources to UTF-8 source makes the System.out prints the SQL correctly like i see debugging the sql variable.
When i insert this test SQL. It is shown correctly with chines characters in the System.out and in the Statement internal variable
INSERT INTO LANGS (IDIOMA,PAIS,TRADUC) VALUES ('zh','TW','TEST1 其他 FIN TEST1');
But in the database the test appears as:
TEST3 FIN TEST3
HEX reprentation:
54 45 53 54 33 20 1A 1A 1A 1A 1A 1A 1A 1A 20 46 49 4E 20 54 45 53 54 33
T E S T 3 _ ? ? ? ? ? ? ? ? _ F I N _ T E S T 3
I think that probably DB2 Java client is using allways Windows codepage (in this case is ISO-8859-1 or cp1252) instead of UTF-8 or the server is converting the data using the main collate instead the alternative collate of the table.
Update3:
I installed a Java SQL tool called DbVisualizer and using this tool on windows when a paste in the SQL panel the SQL and run it is inserted correctly in the databse.
This makes me to suspect that is not a problem of installation or data types. Probably are one of this three factors.
- Client configuration
- Server properties sended when client connects
- Driver type of version used
java sql unicode db2
1
LONG VARCHAR
data type is deprecated. Consider usingDBCLOB
instead, which is specifically provided to support double-byte characters.
– mustaccio
Aug 21 '14 at 13:48
Please define "not working". Are you getting an error when you attempt the insert, or is the insert successful, but you get different data when you query the row you just inserted?
– Ian Bjorhovde
Aug 21 '14 at 15:26
Did you tried to use graphic instead of char? for double byte characters.
– AngocA
Aug 21 '14 at 17:09
not working means data is inserted without error but characters are wrong.
– Dubas
Aug 22 '14 at 6:26
It's not possible to change data types. Database is not property of this application.
– Dubas
Aug 22 '14 at 6:27
add a comment |
I am trying to insert Chinese text in a DB2 Database but not working.
The database is configured by default as ANSI (en_US 819) (and it's a requirement for other applications that use the dame databse) ALT_COLLATE IDENTITY_16BIT is defined and UNICODE tables are created using CCSID UNICODE but unicode characters for Chinese or Korean are not inserted.
Example table:
CREATE TABLE LANGS (
IDIOMA char(2) NOT NULL,
PAIS char(2) NOT NULL,
TRADUC long varchar NOT NULL,
) CCSID UNICODE;
Example insert:
INSERT INTO LANGS (IDIOMA,PAIS,TRADUC) VALUES ('zh','TW','其他');
System Information:
- Server: DB2 9.7 on Ubuntu 64bit (en_US)
- Client: Windows 7 32bit (es_ES) Java 7 with db2jcc.jar
Example Java extract:
Class.forName("com.ibm.db2.jcc.DB2Driver");
...
Properties props = new Properties();
props.setProperty("user", user);
props.setProperty("password", pass);
props.setProperty("DB2CODEPAGE", "1208");
props.setProperty("retrieveMessagesFromServerOnGetMessage", "true");
con = DriverManager.getConnection(url, props);
...
Statement statement = con.createStatement();
statement.execute(sql);
...
statement.close();
con.close();
DB cfg get
DB2 Database locale configuration
Territorio de base de datos = en_US;
Página de códigos de base de datos = 819
Conjunto de códigos de base de datos = iso8859-1
Código de país/región de base de datos = 1
Secuencia de clasificación de base de datos = UNIQUE
Orden de clasificación alternativo (ALT_COLLATE) = IDENTITY_16BIT
Tamaño de página de base de datos = 4096
Statements are executed correctly and rows appears correctly in the database for:
- en_GB
- en_US
- es_ES
- pt_PT
but not for:
- cy_GB
- ko_KR
- zh_TW
Insert from command line with db2cmd also does not work for this languages (Inserts but with only 1 byte.
Insert from command line in a Linux environment localized as zh_TW works.
Insert from command line in a Linux environment localized as en_US.utf-8 works.
Never work on Java on these environments.
Using "X" as prefix form the VARCHAR field is not an option due some restrictions and the SQL works on two environments.
I think it may be some encoding problem on Client, or server due to configuration, file or sql encoding.
Update:
I tried also to load a UTF-8 file with the SQLs. the file loads correctly and debugging the SQL with UTF-8 characters is correctly passed to the Statement but the result is the same.
new InputStreamReader(new FileInputStream(file),"UTF-8")
...
private void executeLineByLine(Reader reader) throws SQLException
StringBuffer command = new StringBuffer();
try
BufferedReader lineReader = new BufferedReader(reader);
String line;
while ((line = lineReader.readLine()) != null)
command = handleLine(command, line);
checkForMissingLineTerminator(command);
catch (Exception e)
String message = "Error executing: " + command + ". Cause: " + e;
printlnError(message);
throw new SQLException(message, e);
private StringBuffer handleLine(StringBuffer command, String line) throws SQLException, UnsupportedEncodingException
String trimmedLine = line.trim();
if (lineIsComment(trimmedLine))
println(trimmedLine);
else if (commandReadyToExecute(trimmedLine))
command.append(line.substring(0, line.lastIndexOf(delimiter)));
command.append(LINE_SEPARATOR);
println(command);
executeStatement(command.toString());
command.setLength(0);
else if (trimmedLine.length() > 0)
command.append(line);
command.append(LINE_SEPARATOR);
return command;
private void executeStatement(String command) throws SQLException, UnsupportedEncodingException
boolean hasResults = false;
Statement statement = connection.createStatement();
hasResults = statement.execute(command);
printResults(statement, hasResults);
statement.close();
Update2:
It's not possible to change the data types. The database is part of other systems and already with data.
The database is installed on 7 different servers on three of it that the data is inserted using Linux in a UTF-8 shell the data was inserted correctly from db2 command line.
From windows db2 command line or using Java it's not possible to insert the characters correctly.
Changing the Java sources to UTF-8 source makes the System.out prints the SQL correctly like i see debugging the sql variable.
When i insert this test SQL. It is shown correctly with chines characters in the System.out and in the Statement internal variable
INSERT INTO LANGS (IDIOMA,PAIS,TRADUC) VALUES ('zh','TW','TEST1 其他 FIN TEST1');
But in the database the test appears as:
TEST3 FIN TEST3
HEX reprentation:
54 45 53 54 33 20 1A 1A 1A 1A 1A 1A 1A 1A 20 46 49 4E 20 54 45 53 54 33
T E S T 3 _ ? ? ? ? ? ? ? ? _ F I N _ T E S T 3
I think that probably DB2 Java client is using allways Windows codepage (in this case is ISO-8859-1 or cp1252) instead of UTF-8 or the server is converting the data using the main collate instead the alternative collate of the table.
Update3:
I installed a Java SQL tool called DbVisualizer and using this tool on windows when a paste in the SQL panel the SQL and run it is inserted correctly in the databse.
This makes me to suspect that is not a problem of installation or data types. Probably are one of this three factors.
- Client configuration
- Server properties sended when client connects
- Driver type of version used
java sql unicode db2
I am trying to insert Chinese text in a DB2 Database but not working.
The database is configured by default as ANSI (en_US 819) (and it's a requirement for other applications that use the dame databse) ALT_COLLATE IDENTITY_16BIT is defined and UNICODE tables are created using CCSID UNICODE but unicode characters for Chinese or Korean are not inserted.
Example table:
CREATE TABLE LANGS (
IDIOMA char(2) NOT NULL,
PAIS char(2) NOT NULL,
TRADUC long varchar NOT NULL,
) CCSID UNICODE;
Example insert:
INSERT INTO LANGS (IDIOMA,PAIS,TRADUC) VALUES ('zh','TW','其他');
System Information:
- Server: DB2 9.7 on Ubuntu 64bit (en_US)
- Client: Windows 7 32bit (es_ES) Java 7 with db2jcc.jar
Example Java extract:
Class.forName("com.ibm.db2.jcc.DB2Driver");
...
Properties props = new Properties();
props.setProperty("user", user);
props.setProperty("password", pass);
props.setProperty("DB2CODEPAGE", "1208");
props.setProperty("retrieveMessagesFromServerOnGetMessage", "true");
con = DriverManager.getConnection(url, props);
...
Statement statement = con.createStatement();
statement.execute(sql);
...
statement.close();
con.close();
DB cfg get
DB2 Database locale configuration
Territorio de base de datos = en_US;
Página de códigos de base de datos = 819
Conjunto de códigos de base de datos = iso8859-1
Código de país/región de base de datos = 1
Secuencia de clasificación de base de datos = UNIQUE
Orden de clasificación alternativo (ALT_COLLATE) = IDENTITY_16BIT
Tamaño de página de base de datos = 4096
Statements are executed correctly and rows appears correctly in the database for:
- en_GB
- en_US
- es_ES
- pt_PT
but not for:
- cy_GB
- ko_KR
- zh_TW
Insert from command line with db2cmd also does not work for this languages (Inserts but with only 1 byte.
Insert from command line in a Linux environment localized as zh_TW works.
Insert from command line in a Linux environment localized as en_US.utf-8 works.
Never work on Java on these environments.
Using "X" as prefix form the VARCHAR field is not an option due some restrictions and the SQL works on two environments.
I think it may be some encoding problem on Client, or server due to configuration, file or sql encoding.
Update:
I tried also to load a UTF-8 file with the SQLs. the file loads correctly and debugging the SQL with UTF-8 characters is correctly passed to the Statement but the result is the same.
new InputStreamReader(new FileInputStream(file),"UTF-8")
...
private void executeLineByLine(Reader reader) throws SQLException
StringBuffer command = new StringBuffer();
try
BufferedReader lineReader = new BufferedReader(reader);
String line;
while ((line = lineReader.readLine()) != null)
command = handleLine(command, line);
checkForMissingLineTerminator(command);
catch (Exception e)
String message = "Error executing: " + command + ". Cause: " + e;
printlnError(message);
throw new SQLException(message, e);
private StringBuffer handleLine(StringBuffer command, String line) throws SQLException, UnsupportedEncodingException
String trimmedLine = line.trim();
if (lineIsComment(trimmedLine))
println(trimmedLine);
else if (commandReadyToExecute(trimmedLine))
command.append(line.substring(0, line.lastIndexOf(delimiter)));
command.append(LINE_SEPARATOR);
println(command);
executeStatement(command.toString());
command.setLength(0);
else if (trimmedLine.length() > 0)
command.append(line);
command.append(LINE_SEPARATOR);
return command;
private void executeStatement(String command) throws SQLException, UnsupportedEncodingException
boolean hasResults = false;
Statement statement = connection.createStatement();
hasResults = statement.execute(command);
printResults(statement, hasResults);
statement.close();
Update2:
It's not possible to change the data types. The database is part of other systems and already with data.
The database is installed on 7 different servers on three of it that the data is inserted using Linux in a UTF-8 shell the data was inserted correctly from db2 command line.
From windows db2 command line or using Java it's not possible to insert the characters correctly.
Changing the Java sources to UTF-8 source makes the System.out prints the SQL correctly like i see debugging the sql variable.
When i insert this test SQL. It is shown correctly with chines characters in the System.out and in the Statement internal variable
INSERT INTO LANGS (IDIOMA,PAIS,TRADUC) VALUES ('zh','TW','TEST1 其他 FIN TEST1');
But in the database the test appears as:
TEST3 FIN TEST3
HEX reprentation:
54 45 53 54 33 20 1A 1A 1A 1A 1A 1A 1A 1A 20 46 49 4E 20 54 45 53 54 33
T E S T 3 _ ? ? ? ? ? ? ? ? _ F I N _ T E S T 3
I think that probably DB2 Java client is using allways Windows codepage (in this case is ISO-8859-1 or cp1252) instead of UTF-8 or the server is converting the data using the main collate instead the alternative collate of the table.
Update3:
I installed a Java SQL tool called DbVisualizer and using this tool on windows when a paste in the SQL panel the SQL and run it is inserted correctly in the databse.
This makes me to suspect that is not a problem of installation or data types. Probably are one of this three factors.
- Client configuration
- Server properties sended when client connects
- Driver type of version used
java sql unicode db2
java sql unicode db2
edited Dec 19 '14 at 7:07
asked Aug 21 '14 at 11:59
Dubas
2,1021430
2,1021430
1
LONG VARCHAR
data type is deprecated. Consider usingDBCLOB
instead, which is specifically provided to support double-byte characters.
– mustaccio
Aug 21 '14 at 13:48
Please define "not working". Are you getting an error when you attempt the insert, or is the insert successful, but you get different data when you query the row you just inserted?
– Ian Bjorhovde
Aug 21 '14 at 15:26
Did you tried to use graphic instead of char? for double byte characters.
– AngocA
Aug 21 '14 at 17:09
not working means data is inserted without error but characters are wrong.
– Dubas
Aug 22 '14 at 6:26
It's not possible to change data types. Database is not property of this application.
– Dubas
Aug 22 '14 at 6:27
add a comment |
1
LONG VARCHAR
data type is deprecated. Consider usingDBCLOB
instead, which is specifically provided to support double-byte characters.
– mustaccio
Aug 21 '14 at 13:48
Please define "not working". Are you getting an error when you attempt the insert, or is the insert successful, but you get different data when you query the row you just inserted?
– Ian Bjorhovde
Aug 21 '14 at 15:26
Did you tried to use graphic instead of char? for double byte characters.
– AngocA
Aug 21 '14 at 17:09
not working means data is inserted without error but characters are wrong.
– Dubas
Aug 22 '14 at 6:26
It's not possible to change data types. Database is not property of this application.
– Dubas
Aug 22 '14 at 6:27
1
1
LONG VARCHAR
data type is deprecated. Consider using DBCLOB
instead, which is specifically provided to support double-byte characters.– mustaccio
Aug 21 '14 at 13:48
LONG VARCHAR
data type is deprecated. Consider using DBCLOB
instead, which is specifically provided to support double-byte characters.– mustaccio
Aug 21 '14 at 13:48
Please define "not working". Are you getting an error when you attempt the insert, or is the insert successful, but you get different data when you query the row you just inserted?
– Ian Bjorhovde
Aug 21 '14 at 15:26
Please define "not working". Are you getting an error when you attempt the insert, or is the insert successful, but you get different data when you query the row you just inserted?
– Ian Bjorhovde
Aug 21 '14 at 15:26
Did you tried to use graphic instead of char? for double byte characters.
– AngocA
Aug 21 '14 at 17:09
Did you tried to use graphic instead of char? for double byte characters.
– AngocA
Aug 21 '14 at 17:09
not working means data is inserted without error but characters are wrong.
– Dubas
Aug 22 '14 at 6:26
not working means data is inserted without error but characters are wrong.
– Dubas
Aug 22 '14 at 6:26
It's not possible to change data types. Database is not property of this application.
– Dubas
Aug 22 '14 at 6:27
It's not possible to change data types. Database is not property of this application.
– Dubas
Aug 22 '14 at 6:27
add a comment |
1 Answer
1
active
oldest
votes
Problem is solved using these steps:
Use always db2jcc4.jar not db2jcc.jar (JDBC 4)
- (In some places JDBC level 2 was configured in the OS classpath with db2jcc instead DB2jcc4 )
Set the environment variable DISABLEUNICODE=0
There is a complete information in this page Understanding DB2 Universal Database character conversion about unicode on DB2
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25425813%2fdb2-insert-utf-8-characters-on-non-unicode-database-with-alt-collate-unicode%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Problem is solved using these steps:
Use always db2jcc4.jar not db2jcc.jar (JDBC 4)
- (In some places JDBC level 2 was configured in the OS classpath with db2jcc instead DB2jcc4 )
Set the environment variable DISABLEUNICODE=0
There is a complete information in this page Understanding DB2 Universal Database character conversion about unicode on DB2
add a comment |
Problem is solved using these steps:
Use always db2jcc4.jar not db2jcc.jar (JDBC 4)
- (In some places JDBC level 2 was configured in the OS classpath with db2jcc instead DB2jcc4 )
Set the environment variable DISABLEUNICODE=0
There is a complete information in this page Understanding DB2 Universal Database character conversion about unicode on DB2
add a comment |
Problem is solved using these steps:
Use always db2jcc4.jar not db2jcc.jar (JDBC 4)
- (In some places JDBC level 2 was configured in the OS classpath with db2jcc instead DB2jcc4 )
Set the environment variable DISABLEUNICODE=0
There is a complete information in this page Understanding DB2 Universal Database character conversion about unicode on DB2
Problem is solved using these steps:
Use always db2jcc4.jar not db2jcc.jar (JDBC 4)
- (In some places JDBC level 2 was configured in the OS classpath with db2jcc instead DB2jcc4 )
Set the environment variable DISABLEUNICODE=0
There is a complete information in this page Understanding DB2 Universal Database character conversion about unicode on DB2
answered Dec 19 '14 at 7:15
Dubas
2,1021430
2,1021430
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f25425813%2fdb2-insert-utf-8-characters-on-non-unicode-database-with-alt-collate-unicode%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
LONG VARCHAR
data type is deprecated. Consider usingDBCLOB
instead, which is specifically provided to support double-byte characters.– mustaccio
Aug 21 '14 at 13:48
Please define "not working". Are you getting an error when you attempt the insert, or is the insert successful, but you get different data when you query the row you just inserted?
– Ian Bjorhovde
Aug 21 '14 at 15:26
Did you tried to use graphic instead of char? for double byte characters.
– AngocA
Aug 21 '14 at 17:09
not working means data is inserted without error but characters are wrong.
– Dubas
Aug 22 '14 at 6:26
It's not possible to change data types. Database is not property of this application.
– Dubas
Aug 22 '14 at 6:27