开发者

{"Could not create the driver from NHibernate.Driver.DB2Driver."} I am using C#.net

We are using Nhibernate to connect to DB2 database. From my C# application. We are able to connect using Odbc and OleDB driver but we need to connect using IBM DB2 driver (IBM.Data.DB2.dll).

We are not able to connect using it. We are getting below error seems NHibernate is not able to create NHibernate.Driver.DB2Driver.

{"Could not create the driver from NHibernate.Driver.DB2Driver."}

This is the connection string we are using.

<property name="dialect">NHibernate.Dialect.DB2Dialect</property>开发者_如何学C;
<property name="connection.driver_class">NHibernate.Driver.DB2Driver</property>
<property name="connection.connection_string">Provider=IBMDADB2;Database=Databasename;Hostname=hostname;Protocol=TCPIP; Port=50000;Uid=username;Pwd=password;</property>


According to the source code, a HibernateException is thrown when the IBM.Data.DB2 assembly cannot be loaded. Make sure that IBM.Data.DB2 is referenced by your project. If you don't reference it in your project, the assembly will not be copied to the output directory and NHibernate will not be able to find it. (The other option would be to install it in the GAC, but I prefer a project reference so that your application is xcopy deployable.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜