nhibernate数据库连接配置

Coordinator
Sep 8, 2011 at 1:50 AM

<!--连接数据库连接池判定-->
 <!--
Provider名称和对应的数据库如下所示。
SqlServer-1.1:Microsoft SQL Server,provider V1.0.5000.0,用于.NET框架V1.1。
SqlServer-2.0(System.Data.SqlClient的别名):Microsoft SQL Server,provider V2.0.0.0,用于.NET框架V2.0。
OleDb-1.1:OleDb,provider V1.0.5000.0,用于.NET框架V1.1。
OleDb-2.0(System.Data.OleDb的别名):OleDb,provider V2.0.0.0,用于.NET框架V2.0。
OracleClient-2.0(System.Data.OracleClient的别名):Oracle,Microsoft provider V2.0.0.0。
OracleODP-2.0(System.DataAccess.Client的别名):Oracle, Oracle provider V2.102.2.20。
MySql:MySQL, MySQL provider 1.0.7.3007(按:Spring.NET的当前版本(1.1 Preview3)需要MySqlConnector 1.0.7.30072,您可以从MySql的网站上单独下载,当然您也可以修改Spring.Data以使用1.08 RC或5.02beta版。)
 
 
 
 SqlServer-1.1
 Microsoft SQL Server, provider V1.0.5.0 in framework .NET V1.1
 
SqlServer-2.0
 Microsoft SQL Server, provider V2.0.0.0 in framework .NET V2.0
 
SqlServerCe-3.1
 Microsoft SQL Server Compact Edition, provider V9.0.242.0
 
SqlServerCe-3.5.1
 Microsoft SQL Server Compact Edition, provider V3.5.1.0
 
OleDb-1.1
 provider V1.0.5000.0 in framework .NET V1.1
 
OleDb-2.0
 provider V2.0.0.0 in framework .NET V2.0
 
OracleClient-2.0
 Oracle, Microsoft provider V2.0.0.0
 
OracleODP-2.0
 Oracle, Oracle provider V2.102.2.20
 
MySql
 MySQL provider 1.0.10.1
 
MySql-1.0.9
 MySQL provider 1.0.9
 
MySql-5.0
 MySQL provider 5.0.7.0
 
MySql-5.0.8.1
 MySQL provider 5.0.8.1
 
MySql-5.1
 MySQL provider 5.1.2.2
 
MySql-5.1.4
 MySQL provider 5.1.2.2
 
MySql-5.2.3
 MySQL provider 5.2.3.0
 
Npgsql-1.0
 Postgresql provider 1.0.0.0 (and 1.0.0.1 - were build with same version info)
 
Npgsql-2.0 -beta1
 Postgresql provider 1.98.1.0 beta 1
 
Npgsql-2.0
 Postgresql provider 2.0.0.0
 
DB2-9.0.0-1.1
 IBM DB2 Data Provider 9.0.0 for .NET Framework 1.1
 
DB2-9.0.0-2.0
 IBM DB2 Data Provider 9.0.0 for .NET Framework 2.0
 
DB2-9.1.0-1.1
 IBM DB2 Data Provider 9.1.0 for .NET Framework 1.1
 
DB2-9.1.0.2
 IBM DB2 Data Provider 9.1.0 for .NET Framework 2.
 
SQLite-1.0.43
 SQLite provider 1.0.43 for .NET Framework 2.0
 
SQLite-1.0.47
 SQLite provider 1.0.43 for .NET Framework 2.0
 
SybaseAse-12
 Sybase ASE provider for ASE 12.x
 
SybaseAse-15
 Sybase ASE provider for ASE 15.x
 
SybaseAse-AdoNet2
 Sybase ADO.NET 2.0 provider for ASE 12.x and 15.x
 
Odbc-1.1
 ODBC provider V1.0.5000.0 in framework .NET V1.1
 
Odbc-2.0
 ODBC provider V2.0.0.0 in framework .NET V2
 
InterSystems.Data.CacheClient
 Caché provider Version 2.0.0.1 in framework .NET V2
 

//提供连接集配置

  <!-- mssql 数据库和Nhibernate的相关配置
  <db:provider id="DbProvider" provider="SqlServer-1.1"
               connectionString="Server=${db.datasource};database=${db.database};uid=${db.user};pwd=${db.password};"/>

   -->
   
  <!-- mysql连接 -->
    <db:provider id="DbProvider"  provider="MySql-5.0"
                   connectionString="Data Source=localhost;User Id=root;Password=123@123;database=NHibernateDemo"/>


    <!-- oracle连接 OracleClient-2.0  OracleODP-2.0
 <db:provider id="DbProvider"  provider="OracleClient-2.0"
                     connectionString="Data Source=orcl;User Id=nhibernate;Password=nhibernate;"/>

 

//方言配置

         <!-- msql
         <entry key="dialect" value="NHibernate.Dialect.MsSql2000Dialect"/>
         <entry key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>       
          -->
          <!--mysql  -->
          <entry key="dialect" value="NHibernate.Dialect.MySQLDialect"/>
          <entry key="hibernate.connection.driver_class" value="NHibernate.Driver.MySqlDataDriver"/>


          <!--oracle  Oracle10gDialect  NHibernate.Driver.OracleClientDriver 
          <entry key="hibernate.connection.driver_class" value="NHibernate.Driver.SqlClientDriver"/>
         
          <entry key="dialect" value="NHibernate.Dialect.Oracle10gDialect"/>
          <entry key="connection.driver_class" value="NHibernate.Driver.OracleClientDriver"/>
            -->