473,728 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DB2 V7.2 fixpak 12 / UTF-8 db doing extra Unicode -> UTF-8 conversion on client?

Help!

We have DB2 V7.2 (fixpak 12) installed on Windows2003 Server, and the latest
V7.2 client installed on another system. The DB2CODEPAGE on all systems is
set to 1208, and the database was created with code set UTF-8 / codepage
1208. (Note: Running our test application described below on the database
host as opposed to a separate client system produced the same results as
described below).

When we perform an INSERT statement passing UTF-8 encoded data to a VARCHAR
column, it appears the client ODBC driver is encoding this again, corrupting
the data. Since the codepages of the client and database are the same, it
shouldn't do anything to the passed data, should it?

We are using VB6 (SP5) / ADO (latest 2.7 release) / ODBC on the client
system. We have written a test application that simply performs an INSERT of
a UTF-8 encoded string. Enabled TRACE on the client system shows the
following information (I know the UTF-8 characters look like junk, but you
can still see that something changed the 3rd column string). Note that the
initial connection reports the codepage values are 1208 on both client /
server. A check of the database using HEX( ) confirms that the retranslated
/ 2nd form is what gets saved in the database.

--------------------------------------------------------------
[ Process: 5232, Thread: 3992 ]
[ Date & Time: 08-08-2004 13:59:49.000004 ]
[ Product: QDB2/NT 7.1.0.98 ]
[ Level Identifier: 030A0105 ]
[ CLI Driver Version: 07.02.0001 ]
[ Informational Tokens: "DB2 v7.1.0.98","n04 0510","WR21337" ]

DBMS NAME="DB2/NT", Version="07.02. 0009", Fixpack="0x230a 0105"
Application Codepage=1208, Database Codepage=1208, Char Send/Recv
Codepage=1208, Graphic Send/Recv Codepage=1200, Application Char
Codepage=1208, Application Graphic Codepage=1200

SQLExecDirectW( hStmt=1:2, pszSqlStr="INSE RT INTO IP.LOG_PROP
(LOG_ID,NAME,VA LUE) VALUES
(x'200408071847 40321428000000' ,'PUB_DESC-1033','пеѬ озаводс ')"
-
X"49004E0053004 500520054002000 49004E0054004F0 02000490050002E 004C004F0047005 F
00500052004F005 000200028004C00 4F0047005F00490 044002C004E0041 004D0045002C005 6
0041004C0055004 500290020005600 41004C005500450 053002000280078 002700320030003 0
003400300038003 000370031003800 340037003400300 033003200310034 003200380030003 0
003000300030003 00027002C002700 5000550042005F0 044004500530043 002D00310030003 3
00330027002C002 700D000BF00D000 B500D1001A20D10 0AC20D000BE00D0 00B700D000B000D 0
00B200D000BE00D 000B400D1008100 D000BA002700290 0", cbSqlStr=125 )

StmtOut="INSERT INTO IP.LOG_PROP (LOG_ID,NAME,VA LUE) VALUES
(x'200408071847 40321428000000' ,'PUB_DESC-1033','пе '?s
',озРвод' Ðº')"

sqlccsend( ulBytes - 388 )
sqlccsend( Handle - 26037648 )
sqlccsend( ) - rc - 0, time elapsed - +2.350000E-004
sqlccrecv( )
sqlccrecv( ulBytes - 456 ) - rc - 0, time elapsed - +7.520000E-004

Row=1, iCol=1, fCType=SQL_C_CH AR, rgbValue="PUB_D ESC-1036" -
X"5055425F44455 3432D31303336", pcbValue=13, piIndicatorValu e=13
Row=1, iCol=2, fCType=SQL_C_CH AR, rgbValue="п µ'?s
',озРвод' Ðº" -
X"C390C2BFC390C 2B5C391E2809AC3 91E282ACC390C2B EC390C2B7C390C2 B0C390C2B2C390C 2
BEC390C2B4C391C 281C390C2BA", pcbValue=50, piIndicatorValu e=50
--------------------------------------------------------------

We've run this test application on another system which uses the V7.1
client, and this client operates as expected - no additional translation is
performed on the UTF-8 encoded string, and it appears in the database
exactly as it was passed. DB2CODEPAGE on this client is also set to 1208.
Here are some lines from that trace. (Note - we have been using a V7.1
database with this setup for some time successfully).

--------------------------------------------------------------
[ Process: 2772, Thread: 4040 ]
[ Date & Time: 08-08-2004 10:59:46.000005 ]
[ Product: QDB2/NT 7.1.0 ]
[ Level Identifier: 02010105 ]
[ CLI Driver Version: 07.01.0000 ]
[ Informational Tokens: "DB2 v7.1.0","n00051 0","" ]

SQLExecDirect( hStmt=1:2, pszSqlStr="INSE RT INTO IP.LOG_PROP
(LOG_ID,NAME,VA LUE) VALUES
(x'200408071847 40321428000000' ,'PUB_DESC-1013','пе,? озаводс ')",
cbSqlStr=125 )

( StmtOut="INSERT INTO IP.LOG_PROP (LOG_ID,NAME,VA LUE) VALUES
(x'200408071847 40321428000000' ,'PUB_DESC-1013','пе,? озаводс ')"
)

sqlccsend( ulBytes - 320 )
sqlccsend( Handle - 90010096 )
sqlccsend( ) - rc - 0, time elapsed - +2.222000E-003
sqlccrecv( )
sqlccrecv( ulBytes - 163 ) - rc - 0, time elapsed - +1.011970E-001
Row=1, iCol=1, fCType=SQL_C_CH AR, rgbValue="PUB_D ESC-1034", pcbValue=13,
piIndicatorValu e=13
Row=1, iCol=2, fCType=SQL_C_CH AR, rgbValue="пе ,?озавод ск",
pcbValue=24, piIndicatorValu e=24

--------------------------------------------------------------

Here, the 3rd column string remains untouched. Checking the database
confirms that using the 7.1 client the correct UTF-8 encoded data is stored.

Notice that the V7.2/fixpak 12 client is using SQLExecDirectW (wide
version?) while the V7.1 client uses SQLExecDirect -- perhaps this is an
indicator of something?

Further experimentation showed that if instead of a UTF-8 string we decode
it into Unicode and pass this off in the INSERT statement with the 7.2 /
FP12 client, then we can see it get translated into UTF-8 in the trace:
--------------------------------------------------------------
SQLExecDirectW( hStmt=1:2, pszSqlStr="INSE RT INTO IP.LOG_PROP
(LOG_ID,NAME,VA LUE) VALUES
(x'200408071847 40321428000000' ,'PUB_DESC-1035','?5B@>702 >4A:')" -
X"49004E0053004 500520054002000 49004E0054004F0 02000490050002E 004C004F0047005 F
00500052004F005 000200028004C00 4F0047005F00490 044002C004E0041 004D0045002C005 6
0041004C0055004 500290020005600 41004C005500450 053002000280078 002700320030003 0
003400300038003 000370031003800 340037003400300 033003200310034 003200380030003 0
003000300030003 00027002C002700 5000550042005F0 044004500530043 002D00310030003 3
00350027002C002 7003F0435044204 40043E043704300 432043E04340441 043A0427002900" ,
cbSqlStr=113

StmtOut="INSERT INTO IP.LOG_PROP (LOG_ID,NAME,VA LUE) VALUES
(x'200408071847 40321428000000' ,'PUB_DESC-1035','пе,? озаводс ')"

sqlccsend( ulBytes - 320 )
sqlccsend( Handle - 26037648 )
sqlccsend( ) - rc - 0, time elapsed - +2.290000E-004
sqlccrecv( )
sqlccrecv( ulBytes - 163 ) - rc - 0, time elapsed - +3.997000E-003
Row=1, iCol=1, fCType=SQL_C_CH AR, rgbValue="PUB_D ESC-1035" -
X"5055425F44455 3432D31303335", pcbValue=13, piIndicatorValu e=13
Row=1, iCol=2, fCType=SQL_C_CH AR, rgbValue="пе ,?озавод ск" -
X"D0BFD0B5D182D 180D0BED0B7D0B0 D0B2D0BED0B4D18 1D0BA", pcbValue=24,
piIndicatorValu e=24
--------------------------------------------------------------

Again, the proper UTF-8 data gets stored in the database, however updating
all of our code to deal with Unicode rather than UTF-8 as currently
configured could take a little time, and I don't want to go through that
exercise if what we are seeing is in fact a bug in DB2.

Any help at all would be appreciated!

--
Timothy G. Northrup
IP.com, Inc.
Nov 12 '05 #1
0 4246

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3602
by: Rene Pijlman | last post by:
I can't seem to find any way to specify the character encoding with the DB API implementation of PyPgSQL. There is no mention of encoding and Unicode in the DB API v2.0 spec and the PyPgSQL README. When I have Unicode strings in Python and store it in a PostgreSQL Unicode database, will the data automatically be correctly encoded? Or do I need to specify the UTF-8 client encoding on the database connection somehow? I'm using the...
16
637
by: ^_^ | last post by:
conversion from: a="a"; to a=0x????; If there are many unicode strings to convert, how can I do batch-conversion?
2
1353
by: Brian Hansen | last post by:
When I tried converting my Access 97 db to 2000, the size of my database increased from 35MB to 70MB even after compacting and repairing. I tried enabling Unicode compression on the table and it only decreased the size of the database by 2MB. It seems to be only one large table that is inflating in size. Please let me know if you have any suggestions. Thanks. Brian
0
1663
by: oozyscab via AccessMonster.com | last post by:
I'm posting this in a couple of places with the hope that someone might see it who has an answer. Has anyone had an experience where data coming from a linked Oracle table can be displayed in a report but not in a form? The scenario is this... I have linked via ODBC (Oracle ODBC Driver version 9. 2.0.65) to an Oracle table that contains some records that have unicode (Korean) characters in one of the fields. When viewing the data in...
2
11214
by: Joey Lee | last post by:
Hi, Does anyone know how I am able to write a utf-8 encoded binary string into binary file? Currently I am given a UTF-8 string which was read from a gif image. Here are my functions... public Byte GetDocument(string DocumentName) { string strdocPath;
5
2224
by: Alex Maghen | last post by:
I frequently find myself wanting to insert some basic client-side JavaScript functions in the page of an ASPX of mine. But I find it so frustrating that I have to actually contruct my JavaScript in C# on the server-side and render it to the client because I can't use the IDs of my controls as they are written in the HTML page itself. Rather, I have to use Control.ClientID to get that ID that I can use in the client-side JS. So my...
9
15736
by: thijs.braem | last post by:
Hi everyone, I'm having quite some troubles trying to convert Unicode to String (for use in psycopg, which apparently doesn't know how to cope with unicode strings). The error I keep having is something like this: ERREUR: Squence d'octets invalide pour le codage UTF8 : 0xe02063 (sorry, locale is french, it means "byte sequence invalid for encoding
2
1748
by: sitko | last post by:
Hi, I'm in the process of converting a VB.net program into a C program so it can run on a unix like machine. I've been moving along at a nice pace, but this conversion has stumped me. I need a function to take two arguments:(a double number which may or may not be an integer, and an integer which will be the number of digits to store after the decimal place) it needs to turn this into a string which is always 10 characters long. if the...
0
8899
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8757
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9418
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9272
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9196
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6013
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4524
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4790
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3235
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.