Simba Mongo ODBC driver: returned data that does not match expected data length

感情迁移 提交于 2019-12-20 05:44:07

问题


We are using Simba Mongo ODBC driver to connect to Mongo database and make sql queries. I tested connection on Linux using isql and was able to perform queries.

When my client tried to connect to Mongo through Microsoft SQL Server Management Studio he received the following error:

OLE DB provider 'MSDASQL' for linked server 'mongo' returned data that does not match
expected data length for column '[MSDASQL].contributorComposite__0__biographicalNote'.
The (maximum) expected data length is 255, while the returned data length is 290.

I've never worked with this application. Have you got any idea where I can control expected data length?


回答1:


Linked Server is very picky about metadata and the data that is returned, in general you're more likely to encounter problems if your defined metadata doesn't match exactly what is expected when using it vs. using other applications.

What's happening in this case is that you're retrieving data with a string column defined. The data in the string column has a length of 290, but the driver is reporting a length of 255. This is because MongoDB doesn't return metadata about the length of any specific field as it is a schema-less data source. The driver instead uses a default for reporting lengths of string columns, which by default is set to 255. You can change this by opening the Configuration Dialog for the DSN, going to the Advanced Options, and changing the Standard string column length from 255 to something larger, like 512. This should allow Linked Server to behave properly unless your data exceeds 512 bytes, in which case you should simply adjust this to a larger appropriate value.



来源:https://stackoverflow.com/questions/26022535/simba-mongo-odbc-driver-returned-data-that-does-not-match-expected-data-length

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!