难道框架4.0具备的功能,用于连接到DB2 [英] Does .Net Framework 4.0 have features for connecting to DB2

查看:281
本文介绍了难道框架4.0具备的功能,用于连接到DB2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道的是有连接到DB2数据库的.NET的框架4.0

I need to know is there any feature of connecting to DB2 database from .net in .Net framework 4.0

编辑: - 我想知道是否有任何DB2提供

- I like to know if there is any DB2 provider

推荐答案

是的,司机的IBM.Data.DB2的家庭(以IBM.Data.DB2.dll集体中,我认为)应该只是罚款与.NET ,为您提供在开发机器上安装驱动程序。

Yep, the family of IBM.Data.DB2 drivers (collectively found in IBM.Data.DB2.dll, I believe) should work just fine with .NET, providing you install the drivers on your development machine.

此外,我能得到它与VS2010Beta和EF4Beta2成功运行,尽管缺乏的Visual Studio加载项的VS2010(截至此日期。)如果驱动程序安装在您的计算机上已经,您只需要为它在Machine.config文件.NET中添加一个条目4.0的CLR。

Additionally, I was able to get it to work successfully with VS2010Beta and EF4Beta2, despite the lack of Visual Studio Add-ins for VS2010 (as of this date.) If the drivers are installed on your machine already, you just need to add an entry for it in the machine.config file for .NET 4.0's clr.

编辑:样品machine.config的标记如下。原来,该配置文件只具有单一的SQL Server DB提供入厂。假设你已经安装在你的机器上的IBM.Data.DB2,你可以做我所做的,只是打开你的2.0的machine.config文件和复制/粘贴项为DB2。充分披露,我真的不知道,如果所有4是必需的,但干净的9.7fp1插入所有四个项目在我的2.0 machine.config中安装,所以我继续复制它们遍布于4.0 machine.config中。复制/粘贴,保存文件,然后重新启动Visual Studio 2010中,你应该能够引用的供应商在你的EDMX与存储模型定义的信息:

Sample machine.config markup follows. Originally, the config file just had the single SQL server DB Provider Factory entry. Assuming you have IBM.Data.DB2 installed on your machine, you can do what I did and simply open up your 2.0's machine.config file and copy/paste the entries for DB2. Full disclosure, I honestly don't know if all 4 are required, but a clean install of 9.7fp1 inserted all four entries in my 2.0 machine.config, so I went ahead and copied them all over to 4.0 machine.config. Copy/paste, save the file, and restart visual studio 2010 and you should be able to reference the provider in your EDMX with the information in the storage model definition:

<edmx:StorageModels>
  <Schema xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl" Namespace="BlahModel.Store" Alias="Self" Provider="IBM.Data.DB2" ProviderManifestToken="IDS/UNIX64, 11.50.0000">

请注意,我很感兴趣,连接到Informix数据库,因此ProviderManifestToken值。但是,我不认为这需要逐字。

Note that I'm interested in connecting to an informix database, hence the ProviderManifestToken value. However, I don't think that's required verbatim.

这是我的4.0 Machine.config中的片段:

The snippet from my 4.0 machine.config:

<system.data>
    <DbProviderFactories>
        <add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
        <add name="IBM DB2 .NET Data Provider" invariant="IBM.Data.DB2" description="IBM DB2 Data Provider for .NET Framework 2.0" type="IBM.Data.DB2.DB2Factory, IBM.Data.DB2, Version=9.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
        <add name="IBM Informix .NET Data Provider" invariant="IBM.Data.Informix" description="IBM Informix Data Provider for .NET Framework 2.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix, Version=9.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
        <add name="IBM DB2 .NET Data Provider 9.7.1" invariant="IBM.Data.DB2.9.7.1" description="IBM DB2 Data Provider 9.7.1 for .NET Framework 2.0" type="IBM.Data.DB2.DB2Factory, IBM.Data.DB2.9.7.1, Version=9.7.1.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />
        <add name="IBM Informix .NET Data Provider 9.7.1" invariant="IBM.Data.Informix.9.7.1" description="IBM Informix Data Provider 9.7.1 for .NET Framework 2.0" type="IBM.Data.Informix.IfxFactory, IBM.Data.Informix.9.7.1, Version=9.7.1.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208" />          
    </DbProviderFactories>
</system.data>

编辑2: IBM的最新的DB2驱动程序 - v9.7fp4 - 大大提高了.NET 4.0和VS2010外接支持。它的安装将自动处理4.0的machine.config DbProviderFactories项。如果previously手动编辑条目,如上所述,你要注释掉/删除它们。因为你v9.7fp3的一部分(或更早)卸载。

EDIT 2: IBM's latest DB2 drivers -- v9.7fp4 -- have greatly improved .NET 4.0 and VS2010 Add-In support. Its installation will automatically handle the 4.0 machine.config DbProviderFactories entries. If you previously manually edited entries, as described above, you'll want to comment out/delete them as part of your v9.7fp3 (and earlier) uninstalls.

这篇关于难道框架4.0具备的功能,用于连接到DB2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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