I used this code in hibernate.cfg.xml configuration:
<?xml version="1.0"?>
<hibernate-configuration xmlns= "urn:nhibernate-configuration-2.2">
<session-factory>
<!-- SQLServer: Provider --><!--
<property name="connection.provider"> NHibernate.Connection.DriverConnectionProvider </property>-->
<!-- SQLServer: Driver -->
<property name="connection.driver_class"> NHibernate.Driver.MySqlDataDriver </property>
<!-- SQLServer: Dialeto -->
<property name="dialect"> NHibernate.Dialect.MySQLDialect </property>
<!-- SQLServer: Connection String -->
<property name="connection.connection_string"> Database=nhibernate;Data Source=localhost;User Id=root;Password=xxxx</property>
<!-- Classe que será utilizada para Proxy
(LazyLoading) -->
<property name="proxyfactory.factory_class"> NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu </property>
</session-factory>
</hibernate-configuration>
I have a problem to create database.
NHibernate.HibernateException: Could not create the driver from NHibernate.Driver.MySqlDataDriver. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> NHibernate.HibernateException: The IDbCommand and IDbConnection implementation in the assembly MySql.Data could not be found. ...
What should I do?
It's simple: add Mysql.Data.dll to the project's bin folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With