简体   繁体   English

使用ODBC从Lotus Notes读取SQL数据库时,数据类型为UNDEFINED:nvarchar

[英]UNDEFINED data type when reading SQL database from Lotus Notes using ODBC: nvarchar

This is the second time it happens to me and before modifying a 3rd party Database structure I wanted to know if anyone knew a better solution: 这是我第二次发生这种情况,在修改第三方数据库结构之前,我想知道是否有人知道更好的解决方案:

I'm accessing a MS SQL Server 2008 from a Lotus Notes Agent (Notes 7) to retrieve some data. 我正在从Lotus Notes代理(注释7)访问MS SQL Server 2008,以检索一些数据。 I use LSXODBC and my "Select" statement works perfect... Except that my agent cannot "understand" Nvarchar SQL Field types. 我使用LSXODBC,并且我的“选择”语句非常完美...除了我的代理无法“理解” Nvarchar SQL字段类型。 Any other data types work ok (can get the values from number and dates fields without a problem). 其他任何数据类型都可以正常工作(可以从数字和日期字段中获取值,而不会出现问题)。

It took me a while to figure it out, and I couldn't find a solution (other than modifying the field types on the SQL table to Varchar instead of nVarchar) 我花了一段时间才弄清楚,但找不到解决方案(除了将SQL表上的字段类型修改为Varchar而不是nVarchar之外)

I could replicate this both in MS SQL 2005 and 2008. 我可以在MS SQL 2005和2008中都复制它。

Last "elegant" solution was to create an SQL view -instead of modifying table structure- with the varchar types instead of nvarchar. 最后一种“优雅”的解决方案是使用varchar类型而不是nvarchar创建一个SQL视图-而不是修改表结构。 Works ok but I have to create a view for each table I'm retrieving data from. 可以,但是我必须为要从中检索数据的每个表创建一个视图。

I tried to set the Field type using FieldExpectedDataType Method but didn't work. 我试图使用FieldExpectedDataType方法设置字段类型,但是没有用。 Still got a DB_TYPE_UNDEFINED. 仍然有一个DB_TYPE_UNDEFINED。

I thought there might be some configuration issues? 我以为可能存在一些配置问题? or maybe I'm using an old LN Version / ODBC Driver version? 还是我使用的是旧的LN版本/ ODBC驱动程序版本?

Any hint would be greatly appreciated. 任何提示将不胜感激。

Thank you in advance. 先感谢您。

Diego 地亚哥

An old ODBC driver may not support unicode. 旧的ODBC驱动程序可能不支持unicode。 It was not added until SQL Server 2000 (I'm fairly sure) 直到SQL Server 2000才添加它(我很确定)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM