0
votes

I need to configure NHibernate 3.1 to target an informix 11.50 database in an asp.net 4.0 application using Fluent NHibernate for mappings.

I have this connection string: jdbc:informix-sqli://server:1530/database:informixserver=lufi_tcp and I have the user an pass. I can connect to to the database using dbvisualizer.

I tray some examples of configuracion that I find on the Internet but it dosen't work.

Can someone get my a link or informacion about what I need to do for configure nhibernate with fluent to target an informix database (for dummies, please.)

S.O: Windows 8 64 bits

Thanks you in advance.

More information:

I Build the session factory in this way:

 class FluentNHibernateLocalSessionFactory : LocalSessionFactoryObject
{
    public string[] FluentNhibernateMappingAssemblies { get; set; }

    protected override ISessionFactory NewSessionFactory(Configuration config)
    {
        return Fluently.Configure()
            .Database(
                 IfxSQLIConfiguration
                .Informix1000
                .Provider<NHibernate.Connection.DriverConnectionProvider>()
                .Driver<NHibernate.Driver.IfxDriver>()
                .Dialect<NHibernate.Dialect.InformixDialect>()
                .ConnectionString("Database=myDatabase;Server=myServer:1530;Persist Security      Info=True;Authentication=Server;uid=myUser;password=myPass;")
                .ShowSql()
            )
            .Mappings(m =>
            {
                foreach (string assemblyName in FluentNhibernateMappingAssemblies)
                    m.FluentMappings.AddFromAssembly(Assembly.Load(assemblyName));
            })
           .BuildConfiguration()
           .BuildSessionFactory();
    }
}

The error I get: {"Could not create the driver from NHibernate.Driver.IfxDriver, NHibernate, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4."}

1
Do not ask for links or code without showing what you tried so far, otherwise this post will be closed... How do you build the nhibernate session factory? Are you using the correct dialect? What is the error? Why are you using an old version of NH?MichaC
I've Updated my question.user2151769

1 Answers

0
votes

You have to add a reference to IBM.Data.Informix otherwise the driver will throw this exception. To do so you have to add a reference to IBM.Data.Informix.dll to the project which is running your code above.