in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Beginner's error on using SQLite with NHibernate

Last post 11-22-2006 4:47 AM by Andreea. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 11-21-2006 7:25 AM

    Beginner's error on using SQLite with NHibernate

    Hi
    I recently discovered SQLite and now I am trying to make it work with NHibernate. The problem is that, when I try to create the ISessionFactory, I get the following error:

    The IDbCommand and IDbConnection implementation in the assembly SQLite.NET could not be found. Please ensure that the assembly SQLite.NET is in the Global Assembly Cache or in a location that NHibernate can use System.Type.GetType(string) to load the types from.

    The thing is that the project I added NHibernate to was one that actually worked with the SQLite reference that it had (and still has). All I did was add NHibernate elements to it. What did I do wrong? (oh, and the non-NHibernate-but-SQLite-related part still works)

    Thank you for your time :)
  • 11-21-2006 8:51 AM In reply to

    Re: Beginner's error on using SQLite with NHibernate

    I'm not sure how nHibernate's factory works ... hopefully someone using it will post here -- but you may get a better answer from the nHibernate folks on their forums.

    Robert

     

  • 11-21-2006 9:11 AM In reply to

    Re: Beginner's error on using SQLite with NHibernate

    I have never used NHibertate, anyway I'm trying to help you.

    You are instructing NHibernate to use the old Finisar SQLite provider which assembly is SQLite.NET and is supported natively by NHibernate. Robert's SQLite Provider for ADO.NET 2.0 is in System.Data.SQLite assembly and NHibernate has not built in support for it yet.

    To use Robert's SQLite Provider for ADO.NET 2.0 with NHibernate you will need to create a SQLiteDriver class implementing the NHibernate.Driver.IDriver interface or inheriting from NHibernate.Driver.ReflectionBasedDriver.

    In your config file you will need to specify your SQLiteDriver this way:

    <nhibernate>
    ....

    <add key="hibernate.connection.driver_class" 
             value="YourNameSpace.SQLiteDriver, YourAssemblyName"
    />
    .....
    </nhibernate>


    Regards

    Jesús López

  • 11-21-2006 9:19 AM In reply to

    Re: Beginner's error on using SQLite with NHibernate

    Oh yes -- if they're using the Finisar library that's definitely the problem.  I thought they had a 2.0 driver out for my provider, though?

    Robert

     

  • 11-21-2006 9:35 AM In reply to

    Re: Beginner's error on using SQLite with NHibernate

    They have a 1.2.0 beta 2 version which includes a new SQLite20Driver for your SQLite provider.


    Regards

    Jesús López

  • 11-21-2006 9:45 AM In reply to

    Re: Beginner's error on using SQLite with NHibernate

    I think they have not done it very well:


    public override bool SupportsMultipleOpenReaders
    {
    get
    {
    return false;
    }
    }

    Regards

    Jesús López

  • 11-22-2006 1:21 AM In reply to

    Re: Beginner's error on using SQLite with NHibernate

    Hi again

    I got past that error by using the 1.2.0 beta 2 version of NHibernate.
    Right now I get a new error, ("Could not create the driver from NHibernate.Driver.SQLiteDriver.") but it seems more of a NHibernate problem so I'll ask on their forums :) :)

    Thank you all for your help :)

    Have a nice day,
    Andreea
  • 11-22-2006 1:50 AM In reply to

    Re: Beginner's error on using SQLite with NHibernate

    In your config file, you should specify SQLite20Driver instead of SQLiteDriver . SQLite20Driver is for Robert's SQLite provider and SQLiteDriver is for the old Finisar SQLite provider.


    Regards

    Jesús López

  • 11-22-2006 4:47 AM In reply to

    Re: Beginner's error on using SQLite with NHibernate

    Thanks!!
    It worked like a charm :) :)
Page 1 of 1 (9 items)
Powered by Community Server (Commercial Edition), by Telligent Systems