从 NHibernate 连接到 ESRI 形状文件(DBase *.dbf 文件)

发布于 2024-07-27 13:04:20 字数 1564 浏览 3 评论 0原文

我一直在尝试找出如何通过 NHibernate 连接到 ESRI 形状文件(我认为是 DBase 表文件),但我尝试过的任何方法都没有成功。

目前,我的配置如下所示:

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<!--<property name="dialect">NHibernate.Dialect.GenericDialect</property>
<property name="connection.driver_class">NHibernate.Driver.OdbcDriver</property>
<property name="connection.connection_string">Database=A303.dbf;protocol=TCPIP</property>-->

<property name="connection.driver_class">NHibernate.Driver.OdbcDriver</property>
<!--<property name="connection.connection_string">driver={IBM DB2 ODBC DRIVER};Database=a303.dbf;protocol=TCPIP</property>-->
<property name="connection.connection_string">Provider=VFPOLEDB.1; Data Source=C:\projects\rm4\Sandbox\bin\Debug\A303.dbf;Extended Properties=dBase III</property>
<property name="dialect">NHibernate.Dialect.DB2Dialect</property>
<property name="use_outer_join">true</property>

<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="show_sql">true</property>

我保留了注释掉的位,以便您可以看到我一直在尝试的值。 无论我尝试什么,我都会收到错误消息:

错误 [IM002] [Microsoft][ODBC Driver Manager] 未找到数据源名称且未指定默认驱动程序

我已经完成了大部分连接我在网上找到的字符串以及这里问题的一些答案正在进入“抓住稻草”阶段,我只是在其中放入任何东西,所以我认为我最好寻求帮助。

我什至不确定是否可以从 NHibernate 连接到这种类型的文件,但是如果可以,有人知道配置中应该包含什么吗?

I've been trying to work out how to connect to an ESRI shape file (which I think is a DBase table file) through NHibernate but haven't had any luck with anything I've tried.

Currently, my config's looking like this:

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<!--<property name="dialect">NHibernate.Dialect.GenericDialect</property>
<property name="connection.driver_class">NHibernate.Driver.OdbcDriver</property>
<property name="connection.connection_string">Database=A303.dbf;protocol=TCPIP</property>-->

<property name="connection.driver_class">NHibernate.Driver.OdbcDriver</property>
<!--<property name="connection.connection_string">driver={IBM DB2 ODBC DRIVER};Database=a303.dbf;protocol=TCPIP</property>-->
<property name="connection.connection_string">Provider=VFPOLEDB.1; Data Source=C:\projects\rm4\Sandbox\bin\Debug\A303.dbf;Extended Properties=dBase III</property>
<property name="dialect">NHibernate.Dialect.DB2Dialect</property>
<property name="use_outer_join">true</property>

<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<property name="show_sql">true</property>

I've left the commented out bits in so you can see what values I've been trying. No matter what I try, I get the error message:

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I've gone through most of the connection string I've found online and in some answers to questions on here was getting to the 'clutching at straws' phase where I'm just putting anything in so thought I'd better ask for help.

I'm not even sure if it's possible to connect to this type of file from NHibernate but, if it is, does anyone know what should be in the config?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏有森光若流苏 2024-08-03 13:04:21

Shapefile (.shp) 本身并不是 dbf。 它实际上是一个文件集合,其中一个是 DBF,但存储几何图形的 shapefile 本身是一种完全不同的格式。

ESRI 网站 (www.esri.com) 上有一份白皮书

A Shapefile (.shp) is not a dbf, per se. It actually is a collection of files, one of which is a DBF, but the shapefile itself that stores the geometry is a different format altogether.

There is a whitepaper on the ESRI website (www.esri.com)

李不 2024-08-03 13:04:21

我会尝试不同的 NHibernate 驱动程序。 以下是文档中的 NHibernate 驱动程序列表。

从连接字符串中的提供程序名称来看,我会尝试 NHibernate.Driver.OleDbDriver。

如果做不到这一点,我将从组合中消除 NHibernate,并查看是否可以使用标准 .NET 数据类(例如 System.Data.Odbc.OdbcConnection 和 System.Data.OleDb.OleDbConnection)进行连接。 如果在此级别无法连接,则问题不在于 NHibernate。

I would try a different NHibernate driver. Here is a list of NHibernate drivers from the documentation.

Judging from the provider name in your connection string, I would try NHibernate.Driver.OleDbDriver.

Failing this, I would eliminate NHibernate from the mix and see if you can connect using the standard .NET data classes, such as System.Data.Odbc.OdbcConnection and System.Data.OleDb.OleDbConnection. If you cannot connect at this level, then the problem is not NHibernate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文