MySQL
All MySQL versions should work, though there are issues with zero dates (see below for details). To connect to your database use Connector/NET (formerly known as ByteFX.Data.MySqlClient).
Connection string and settings example:
<add key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.dialect"
value="NHibernate.Dialect.MySQLDialect" />
<add key="hibernate.connection.driver_class"
value="NHibernate.Driver.MySqlDataDriver" />
<add key="hibernate.connection.connection_string"
value="Server=server;Database=database;User ID=user;Password=password;CharSet=win1250" />
value="NHibernate.Connection.DriverConnectionProvider" />
<add key="hibernate.dialect"
value="NHibernate.Dialect.MySQLDialect" />
<add key="hibernate.connection.driver_class"
value="NHibernate.Driver.MySqlDataDriver" />
<add key="hibernate.connection.connection_string"
value="Server=server;Database=database;User ID=user;Password=password;CharSet=win1250" />
Issues
MySQL has a unique "feature" of allowing invalid dates in a DATE field, and especially using 0000-00-00 as a default value for DATE NOT NULL columns. When MySQL Connector encounters such a date, it either throws an exception or returns a non-standard MySqlDateTime object (depending on a connection string parameter) which throws an exception when converting itself to a DateTime.
Possible workarounds:
- avoid zero dates
- modify Connector/NET source code to round zero dates to DateTime.Min and back (see JIRA issue NH-32 for a patch to an older version of the Connector)
- create a user type for MySqlDateTime (no known implementations currently)