jeudi 21 octobre 2010

Connect to Oracle using NHibernate

Here is my setup to connect to an Oracle database using the ODP.NET provider.

Install Oracle client v9 R2 or greater.

Reference Oracle.DataAccess dll in your project.

Configure your database connection in the tnsnames.ora file. This file is located in $ORACLE_HOME/network/admin/tnsnames.ora.

Configure your connection string in your application. I usually use this syntax:

<add name="default" connectionstring="Data Source=tnsnames_alias;User ID=username;Password=pwd">

Then use the OracleDataClientDriver in your NHibernate configuration or OracleDataClientConfiguration if you use FluentNHibernate.

This should do it!

Aucun commentaire:

Enregistrer un commentaire