Hi,
I was wondering if anyone could advise me on this.
Right now I am setting up a DB2 UDB V8.2.3 database with UTF8
character set, which will work with a J2EE application running on
WebSphere Application Server.
I have two questions:
1. How many characters, such as Chinese, Japanese, can a CHAR(128) or
CLOB(4000) column take? From the DB2 document, it looks that the
CHAR(128) means 128 bytes, instead of 128 characters. Since some double
type characters may take up to 3 bytes in UTF8, a CHAR(128) can only
store 40 ( 1/3 of 128) characters. Is there a easier way to tell how
many characters a CHAR or CLOB column can take?
And interstingly, I happened to see that in Oracle the environment
varialble NLS_LENGTH_SEMA NTICS = 'CHAR' can guarantee the CHAR(128)
holds 128 characters at the database level. And it also support a
modifier, such as CHAR(128 char), to specify at column level. Please
correct me if I am wrong. But I was just wondering would it be nice if
DB2 provides the same feature.
2. From performance's point of view, should I set DB2 character set
UTF8 or UTF16? Since Java uses only UTF16, does that mean that the java
program or JDBC has to do converstion for each character?
Any comments are highly appreciated!
Jason Zhang 2 10309
Jason,
Your understanding is correct. In DB2, CHAR(128) is 128 bytes, which
for Chinese characters will be a little over 40 characters. If you
store English data in that column, it will hold 128 characters, since
they take 1 byte per character. And, I agree, it would be nice if there
were an option to specify characters rather than bytes.
One solution, to hold enough characters is to make the column VARCHAR
and large enough for the number of characters you need (e.g.
VARCHAR(384) in this case). But, the application would have to ensure
that no more than 128 characters were entered if that is what you want.
As for UTF8 vs UTF16, it is true that there would be some conversion
for Java, but I personally would not worry about too much. If you have
Java programs currently accessing non-unicode tables, you're getting
that conversion today. Note that in UTF16, most Chinese characters are
2 bytes, as are all English characters. So, spacewise, it depends on
what languages you plan to mostly store.
Joe
Jason wrote:
Hi,
I was wondering if anyone could advise me on this.
Right now I am setting up a DB2 UDB V8.2.3 database with UTF8
character set, which will work with a J2EE application running on
WebSphere Application Server.
I have two questions:
1. How many characters, such as Chinese, Japanese, can a CHAR(128) or
CLOB(4000) column take? From the DB2 document, it looks that the
CHAR(128) means 128 bytes, instead of 128 characters. Since some double
type characters may take up to 3 bytes in UTF8, a CHAR(128) can only
store 40 ( 1/3 of 128) characters. Is there a easier way to tell how
many characters a CHAR or CLOB column can take?
And interstingly, I happened to see that in Oracle the environment
varialble NLS_LENGTH_SEMA NTICS = 'CHAR' can guarantee the CHAR(128)
holds 128 characters at the database level. And it also support a
modifier, such as CHAR(128 char), to specify at column level. Please
correct me if I am wrong. But I was just wondering would it be nice if
DB2 provides the same feature.
2. From performance's point of view, should I set DB2 character set
UTF8 or UTF16? Since Java uses only UTF16, does that mean that the java
program or JDBC has to do converstion for each character?
Any comments are highly appreciated!
Jason Zhang
Joe Geller wrote:
One solution, to hold enough characters is to make the column VARCHAR
and large enough for the number of characters you need (e.g.
VARCHAR(384) in this case). But, the application would have to ensure
that no more than 128 characters were entered if that is what you want.
You could write a UDF and use it in a constraint on the table/column in
question. Then you have the integrity ensured at the database level.
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sinasalek |
last post by:
i have a problem with MySQL 4.1.x and UTF8.
in version 4.0, i'm using html forms with utf8 charset for inserting
unicode strings. but in version 4.1.x it is not working! if i change the
charset of column,
ALTER TABLE `icons` CHANGE `name_farsi` `name_farsi` VARCHAR( 99 )
CHARACTER SET utf8 COLLATE utf8_persian_ci DEFAULT NULL
and change default charset of database like below code :
|
by: kieran |
last post by:
Hi,
I'm using fstream.get to read in a character from a file, then print it
on the screen. I have a file called test.log that contains "Hello,
World!", but when I try and print the contents out on the screen I get
"Hello, World!!". The following is the code (please ignore all
wxWidgets classes):
void SystemBackupFrm::compress()
{
using namespace std;
|
by: Jim |
last post by:
All of a sudden I am unable to create tables or add columns to
existing tables if I specify CHARACTER greater than 254. If I try I
get the following error:
DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0604N The length, precision, or scale attribute for column,
distinct type,
|
by: Daniel Rimmelzwaan |
last post by:
Does anyone know how to convert a (char)02 into a UTF8 string that I can put
into an XML element? I've tried all examples that I could find in Visual
Studio help or in google, but I can't get it to work. The one that gives me
the answer will just make my day :).
Thanks,
Daniel.
|
by: bob |
last post by:
I am binding a datatable to a datagrid in VB.NET I then want to change
the width of the first column. I am unable to get the right syntax.
Here is the code I tried
Dim mydataset As DataSet
gclodatabase.GetDataSetJobs("Select * from qryJobs",
mydataset)
| |
by: aniendow |
last post by:
Hi All,
I am trying to upload a TAB delimited file into a database table. Considering the performance issue I thought EXTERNAL TABLE is my best option but with one problem, My table has CLOB columns but when I tried to create EXTERNAL TABLE with CLOB column Oracle is giving error saying
"column type is not supported in external organised table."
:confused:
But I have to upload the flat file data along with the CLOB columns... how...
|
by: motykosh |
last post by:
Hi,
I'm using DB2 V9.1 and php on a redhat 4 64Bit production server. When I take a backup from that server and restore it on a 64Bit ubuntu 7.04 server with the same version of DB2 and PHP, the clob data is different from what it was on production.
I use clob for binary data, because of the varitety of bugs php 5 has with BLOB columns in db2. The server codepage is identical on both server. The ibm_db2 php extention is identical as well....
|
by: codeGhost |
last post by:
I've been trying to ignore this issue for a while now, but I've come to the point in my code where I can't do so anymore. (For those of you who are wondering, this is NOT a homework question).
Platform: VC++ 2002
System: Windows XP, sp3
::First, here's the code in question::
char * cSection (const char* data, int start, int finish)
{
|
by: TTheot |
last post by:
Hallo everyone.
I am trying to call an unmanaged C++ function, that has a structure as an input parameter.
The structure is defined in the header file like this:
struct MyStruct
{
int siOrder;
char aaszNames;
int siId;
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |