Depends on the documentation databases supported by nhib.pdf in nhib.pdf
Nhibernate is primarily tested on Microsoft SQL Server 2000. It is also known to work on these databases:
- Microsoft SQL Server 2005/2000
- Oracle
- Microsoft Access
- Firebird
- PostgreSQL
- DB2 UDB
- MySQL
- SQLite
Microsoft SQL Server 2005/2000
SQL Server 2005 and 2000 are the primary databases used by the developers of nhib.pdf.
Configuration example:
<? XML version = "1.0"?>
<Hibernate-configuration xmlns = "urn: nhibernate-configuration-2.2">
<Session-factory>
<Property name = "connection. provider"> nhib.pdf. Connection. driverconnectionprovider </property>
<Property name = "dialect"> nhib.pdf. dialect. mssql2005dialect </property>
<Property name = "connection. driver_class"> nhib.pdf. Driver. sqlclientdriver </property>
<Property name = "connection. connection_string"> Server = (local); initial catalog = dbname; user id = user; Password = ******** </property>
</Session-factory>
</Hibernate-configuration>
For SQL Server 2000, change the dialectNhib.pdf. dialect. mssql2000dialect.
Issues
SQL Server sometimes ignores columns specified inOrderClause of a query if they are not supported inSelectClause. This behavior is actually valid according to the SQL standard, but may be surprising. For example, a query like this is not guaranteed to be ordered correctly:
From person P order by P. Company. Name
Oracle
Oracle 9i and 10g are supported, both using Microsoft Driver (System. Data. oracleclient) And using Oracle Driver (Oracle. Data. oracleclient).
Issues
Microsoft's driver does not handle long character strings correctly. An error happens in some circumstances when using a string of length 2000-4000 as a parameter value.
Oracle cannot handle empty strings (""), You shocould use null instead. An iusertype implementation to perform the conversion is contained in nullables. Nhibernate Library (part of nhibernatecontrib package ).
Microsoft Access
Microsoft Access has its own dialect and driver (contributed by Lukas krejci ).
They are currently in a separated Library:Nhib.pdf. jetdriver. dll(In nhibernatecontrib package ).
Here is what yourHibernate. cfg. xmlFile shoshould contain when using a Microsoft Access database:
<? XML version = "1.0"?>
<Hibernate-configuration xmlns = "urn: nhibernate-configuration-2.2">
<Session-factory>
<Property name = "connection. provider"> nhib.pdf. Connection. driverconnectionprovider </property>
<Property name = "dialect"> nhib.pdf. jetdriver. jetdialect, nhib.pdf. jetdriver </property>
<Property name = "connection. driver_class"> nhib.pdf. jetdriver. jetdriver, nhib.pdf. jetdriver </property>
<Property name = "connection. connection_string"> provider = Microsoft. Jet. oledb.4.0; Data Source = yourdatabasefilepathhere. mdb </property>
</Session-factory>
</Hibernate-configuration>
Issues
There are still few problems with join syntax in queries that use more than one join. This driver passes 93% of Nhibernate tests (there are 23 failing tests ).
The most complete topic about these issues is here: Using nhib.pdf with Microsoft Access 2003/JET 4.0. JIRA issues NH-124 and NH-437 have some information on problems with implementing Microsoft Access dialect. you can also try searching Nhibernate forum for "Access Jet" (require all words ).
Firebird
Firebird is supported since version 1.5.3, though version 2.0.1 is stronugly recommended. to work with Firebird, install the latest Firebird. NET data provider. if the data provider is installed in the GAC (the standard behavior of its installer), add this section to your application configuration file (App. configOrWeb. config):
<Runtime>
<Assemblybinding xmlns = "urn: Schemas-Microsoft-com: ASM. V1">
<Qualifyassembly partialname = "firebirdsql. Data. firebirdclient"
Fullname = "firebirdsql. Data. firebirdclient, version = 2.0.1.0, culture = neutral, publickeytoken = 3750abcc3150b00c"/>
</Assemblybinding>
</Runtime>
The value ofFullnameAttribute will depend on the version of the Assembly you have installed in the GAC.
Here is what yourHibernate. cfg. xmlFile shoshould contain when using Firebird:
<Hibernate-configuration xmlns = "urn: nhibernate-configuration-2.2">
<Session-factory name = "nhib.pdf. Test">
<Property name = "connection. provider"> nhib.pdf. Connection. driverconnectionprovider </property>
<Property name = "connection. driver_class"> nhib.pdf. Driver. firebirdclientdriver </property>
<Property name = "connection. Isolation"> readcommitted </property>
<Property name = "connection. connection_string">
Server = localhost;
Database = c: \ nhib.pdf. FDB;
User = sysdba; Password = masterkey
</Property>
<Property name = "show_ SQL"> false </property>
<Property name = "dialect"> nhib.pdf. dialect. firebirddialect </property>
<Property name = "use_outer_join"> true </property>
<Property name = "command_timeout"> 444 </property>
<Property name = "query. substitutions"> true 1, false 0, yes 1, no 0 </property>
</Session-factory>
</Hibernate-configuration>
All Firebird 2.0.1 embedded functions are registered in the dialect, as well as user-defined functions fromIb_udf2. SQL. These functions can be used in hql queries.
PostgreSQL
PostgreSQL version 7.4 with latest npgsql works almost perfectly. Later versions shocould work too.
Configuration example:
<? XML version = "1.0" encoding = "UTF-8"?>
<Hibernate-configuration xmlns = "urn: nhibernate-configuration-2.2">
<Session-factory name = "nhib.pdf. Test">
<Property name = "connection. provider"> nhib.pdf. Connection. driverconnectionprovider </property>
<Property name = "connection. driver_class"> nhib.pdf. Driver. npgsqldriver </property>
<Property name = "connection. connection_string">
Server = localhost; initial catalog = nhibalog; user id = Nhibernate; Password = ********;
</Property>
<Property name = "dialect"> nhib.pdf. dialect. postgresqldialect </property>
</Session-factory>
</Hibernate-configuration>
DB2 UDB
DB2 UDB is supported and reportedly even passes all the tests (see http://nhibernate.sourceforge.net/forum/viewtopic.php? T = 73). example configuration using the ODBC drivers that come with the 'stinger 'release of DB2:
<? XML version = "1.0" encoding = "UTF-8"?>
<Hibernate-configuration xmlns = "urn: nhibernate-configuration-2.0">
<Session-factory name = "session">
<Property name = "connection. provider"> nhib.pdf. Connection. driverconnectionprovider </property>
<Property name = "connection. driver_class"> nhib.pdf. Driver. odbcdriver </property>
<Property name = "connection. connection_string "> driver = {IBM DB2 ODBC driver}; database = dB; hostname = host; Port = port; Protocol = TCPIP; uid = uid; Pwd = PWD </property>
<Property name = "show_ SQL"> true </property>
<Property name = "dialect"> nhib.pdf. dialect. db2dialect </property>
<Property name = "use_outer_join"> true </property>
<Mapping Resource = "..."/>
</Session-factory>
</Hibernate-configuration>
MySQL
All MySQL versions shocould 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 ).
Configuration example:
<? XML version = "1.0" encoding = "UTF-8"?>
<Hibernate-configuration xmlns = "urn: nhibernate-configuration-2.2">
<Session-factory name = "nhib.pdf. Test">
<Property name = "connection. provider"> nhib.pdf. Connection. driverconnectionprovider </property>
<Property name = "connection. driver_class"> nhib.pdf. Driver. mysqldatadriver </property>
<Property name = "connection. connection_string">
Database = test; Data Source = someip; user id = blah; Password = blah
</Property>
<Property name = "dialect"> nhib.pdf. dialect. mysqldialect </property>
</Session-factory>
</Hibernate-configuration>
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)
SQLite
SQLite Version 3 works rather well using ADO. net provider available from http://sourceforge.net/projects/adodotnetsqlite. Nhibernate query analyzer uses SQLite (see [related projects]).
Configuration example:
<? XML version = "1.0" encoding = "UTF-8"?>
<Hibernate-configuration xmlns = "urn: nhibernate-configuration-2.2">
<Session-factory name = "nhib.pdf. Test">
<Property name = "connection. provider"> nhib.pdf. Connection. driverconnectionprovider </property>
<Property name = "connection. driver_class"> nhib.pdf. Driver. sqlitedriver </property>
<Property name = "connection. connection_string">
Data Source = nhib.pdf. DB; version = 3
</Property>
<Property name = "dialect"> nhib.pdf. dialect. sqlitedialect </property>
<Property name = "query. substitutions"> true = 1; false = 0 </property>
</Session-factory>
</Hibernate-configuration>
Issues
SQLite currently fails 17 tests out of approximately 500 in nhib1_test suite. some of the failures are caused by SQLite being unable to store strings containing NUL characters, other tests fail because of a bug in SQLite ADO. net provider when using a table with spaces in its name.
Like (0)
62248 View