Simba Mongo ODBC驱动程序:返回的数据与预期的数据长度不匹配 [英] Simba Mongo ODBC driver: returned data that does not match expected data length

查看:94
本文介绍了Simba Mongo ODBC驱动程序:返回的数据与预期的数据长度不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Simba Mongo ODBC驱动程序连接到Mongo数据库并进行sql查询.我使用isql在Linux上测试了连接,并能够执行查询.

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.

当我的客户端尝试通过Microsoft SQL Server Management Studio连接到Mongo时,他收到以下错误:

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?

推荐答案

Linked Server对元数据和返回的数据非常挑剔,通常,如果您定义的元数据不完全匹配,则您更有可能遇到问题与使用其他应用程序相比,使用它会有什么期望.

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.

在这种情况下,发生的事情是您正在使用定义的字符串列检索数据.字符串列中的数据长度为290,但驱动程序报告的长度为255.这是因为MongoDB不会返回有关任何特定字段长度的元数据,因为它是无模式数据源.相反,驱动程序使用默认值来报告字符串列的长度,默认情况下设置为255.您可以通过打开DSN的配置"对话框,转到高级选项",然后将标准字符串列的长度"从255更改为来更改此默认值.较大的东西,例如512.这将使Linked Server正常工作,除非您的数据超过512字节,在这种情况下,您只需将其调整为更大的适当值即可.

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.

这篇关于Simba Mongo ODBC驱动程序:返回的数据与预期的数据长度不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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