您的位置:首页 > 数据库

使用ODBC方式读取sybase数据库的时候,如果字符串大于4k(4096),结果只能读取到4096个字符(关键字 SYBASE TEXT 4096 截断 TRUNCATE)

2013-10-17 14:25 453 查看
没搞过sybase ,这次搞sybase遇到这种很难在中午网上找到答案的问题,最终还是向英文网站求助

O(∩_∩)O哈哈~

总结解决方案:

Check these steps out - there is a new attribute to handle the Buffer column

size, not available in the

GUI configuration (I tried to get this in there!) and not sure why it can't be

there. The problem occurred at the

older 3.50 level when the driver started supporting Static cursors. Check these

items below and it should be OK ...

1. Check the TEXTSIZE for the ASE. On 12.5 it defaults to 32768 bytes. You

need this set to the anticipated

maximum text/image size.

2. The DSN itself has 2 options for this limitation. "DefaultLongDataBuffLen"

or Default Buffer Size for Long

Columns defaults to 1024 KBs (or 1 MB).

3. The StaticCursorLongColBuffLen was introduced to the 3.50 CtLib based driver

(12.0) for when the application

uses cursors. It is not accessible via the configuration screens and must be

added to the registry under the

DSN being used. This option defaults to 4096 Bytes (4K). You need to add this

in your connection string

(StaticCursorLongColBuffLen (SCLCBL - I think)) in BYTEs.(我就用的这个方案解决了问题)

These options have limitations because the driver pre-allocates these buffers

whenever the TEXT or IMAGE

datatype is to be used in your stmt.

On ASE whenever the text/image size is limited, silent truncation usually

occurs. This is behavior

on the ASE not the client.

I suggest you setup the 2 buffer length parameters in anticipation of the

maximim size of the BLOB type. The pre-allocation occurs

during the runtime, not when the driver itself is initialized.

实际操作:

在HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\<ODBC 的dsn名称>注册表下,添加StaticCursorLongColBuffLen值为40960

当然这个值不一定要40960,只要大于4096就可以了哦

北大方正数字媒体部门陈炼

2013年10月17日14:24:17
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐