DB2 VARCHAR unicode 数据存储 [英] DB2 VARCHAR unicode data storage

查看:48
本文介绍了DB2 VARCHAR unicode 数据存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在使用 VARCHAR 在 DB2 中存储文本数据,但是我们遇到了一个问题,即指定的 VARCHAR 长度与文本长度不同,因为在 DB2 中,指定的 VARCHAR 长度是 UTF-8 数据长度,该长度可能会有所不同存储的文本数据.例如,某些文本包含来自不同语言的字符,因此某些 500 个字符的文本无法保存在 VARCHAR(500) 等中.

We are currently using VARCHAR for storing text data in DB2 however we are hitting the problem that length of VARCHAR specified is not the same as length of text because in DB2 VARCHAR length specified is UTF-8 data length which can vary depending on stored text data. For example some texts contain characters from different languages and because of it some texts with 500 characters can't be saved in VARCHAR(500) and etc.

现在我们计划迁移到 VARGRAPHIC.我需要知道使用 VARGRAPHIC 在 DB2 中存储 unicode 文本数据有哪些限制.使用 VARGRAPHIC 有什么问题吗?

Now we are planning to migrate to VARGRAPHIC. I need to know what are limitations of using VARGRAPHIC for storing unicode text data in DB2. Are there any problems with using VARGRAPHIC?

推荐答案

DB2 不检查数据是否实际上是双字节字符串,但它假定它必须是.通常驱动程序会为您进行适当的转换,但您可能有一天会遇到一些错误.不过这不太可能.

DB2 doesn't check that the data is in fact double-byte String, but it assumes it must be. Usually the drivers will do proper conversions for you but you might one day bump into some bug. It is unlikely though.

如果您在查询中使用联合数据库 Vargraphic 支持可能会完全失败.总的来说,关于 vargraphic 数据类型的错误报告数量有点高.对它的支持可能没有像其他数据类型那样得到很好的测试和尝试.

If you use federated databases Vargraphic support in queries might fail completely. In overall the amount of bug reports for vargraphic data types is somewhat high. Support for it isn't probably as well tested and tried as for other data types.

Vargraphic 将使用 unicode 数据库(即要求 UTF-8)使用大端 UCS-2,这意味着您对这些列的空间要求加倍.Vargraphic 是 DB2 专有数据类型.如果有一天您从 DB2 迁移出去,您将不得不进行额外的转换.

Vargraphic will with unicode database (ie. UTF-8 is requirement) use big-endian UCS-2, meaning your space requirements for those columns double. Vargraphic is DB2 properietary data type. If you migrate off DB2 some day you will have to do an extra conversion.

这篇关于DB2 VARCHAR unicode 数据存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆