0
votes

I have some web application that using Fluent NHibernate as the ORM and ORACLE 11g as the database.

Below is my Configuration Builder look a like

return Fluently.Configure()
                .Database(OracleDataClientConfiguration.Oracle10
                                .ConnectionString(c => c.FromConnectionStringWithKey("ora"))
                                .AdoNetBatchSize(100)
                                .Driver<NHibernate.Driver.OracleClientDriver>()
                         )
                .Mappings(mappings => mappings.FluentMappings.AddFromAssemblyOf<UserMapping>())
                //.ExposeConfiguration(ReCreateSchema)
                .BuildConfiguration();

And below is my Connection String

<connectionStrings>
    <add name="ora" connectionString="Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=1521))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME=serviceName)));User Id=uidxx;Password=pwdxx;" />
  </connectionStrings>

From the configuration, the next step is build the session factory

ISessionFactory sesionFactory = config.BuildSessionFactory();

Whenever I run the application, it will throw an error with code

ORA-06413: Connection not Open

Is there any configuration that I miss? I'm also try to research for the solution but found nothing. And also I try to replace the configuration with OracleClientConfiguration.Oracle10 but I got the same result.

Thanks!

1

1 Answers

0
votes

After some research and did some trial/error (sigh) Found that I must change the configuration builder into like this

return Fluently.Configure()
                .Database(OracleManagedDataClientConfiguration.Oracle10
                                .ConnectionString(c => c.FromConnectionStringWithKey("ora"))
                                .AdoNetBatchSize(100)
                                .Driver<NHibernate.Driver.OracleManagedDataClientDriver>()
                         )
                .Mappings(mappings => mappings.FluentMappings.AddFromAssemblyOf<UserMapping>())
                //.ExposeConfiguration(ReCreateSchema)
                .BuildConfiguration();

And also I must to install the ORACLE DATA PROVIDER for NET Framework (ODP.NET) before I build this application.