Using JET Driver (Microsoft Access) with nHibernate 3

836 views
Skip to first unread message

Doc Saintly

unread,
Jul 26, 2011, 4:53:38 AM7/26/11
to nhusers
I'm working on my first nHibernate project and piecing together some
details from a few tutorials. I believe I have most of the mapping
right, but it turns out that I can't get the Jet driver to work.

After following the instructions on this page:
http://www.thoughtproject.com/Snippets/NHibernateWithAccess/
I noticed that I was actually missing the Jet DLL.

I went to the trunk and built one, as well as tried the one from here:
http://coderead.wordpress.com/2010/10/20/nhibernate-jet-driver/

One of the comments on that page alludes to a solution involving the
config file. Can anyone help with this? My config file is pasted
below:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >

<!-- For simplicity, the NHibernate configuration is stored in this
file.
It must be named hibernate.cfg.xml and marked in Visual Studio to be
copied
to the output folder. -->

<session-factory>

<!-- By default NHibernate is aggressive in closing connections
between
SQL statments. This unfortunately causes a problem when reading
ID
numbers assigned by Access (e.g. in AutoNumber fields). See
comments
in the Test 1 section of Program.cs. -->

<!-- B<property name="hibernate.connection.release_mode">on_close</
property> -->

<property
name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
property>
<property name="dialect">NHibernate.JetDriver.JetDialect,
NHibernate.JetDriver</property>
<property
name="connection.driver_class">NHibernate.JetDriver.JetDriver,
NHibernate.JetDriver</property>

<property name="show_sql">true</property>

<property name="proxyfactory.factory_class">
NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu
</property>

<!-- The Sample.mdb file is located in the folder containing the
solution file. This is three folders upward. Relative paths
are supported in Jet connection strings. -->

<property
name="connection.connection_string">Provider=Microsoft.Jet.OLEDB.
4.0;Data Source=TieIns.mdb</property>
</session-factory>
</hibernate-configuration>

Doc Saintly

unread,
Jul 26, 2011, 11:37:38 PM7/26/11
to nhusers
I don't want to call this issue closed, but I made some progress by
compiling the Jet driver from contrib against .Net 3.5 and referenced
the newest log4net, nHibernate, and a few others.

I'm going to make a new post more specific to the current problem
(Invalid index 21 for this OleDbParameterCollection with Count=21),
but will also keep an eye on this thread in case the Jet driver is the
underlying problem.


On Jul 26, 1:53 am, Doc Saintly <docsain...@gmail.com> wrote:
> I'm working on my first nHibernate project and piecing together some
> details from a few tutorials. I believe I have most of the mapping
> right, but it turns out that I can't get theJetdriver to work.
>     are supported inJetconnection strings.  -->

Agelos panagiotakis

unread,
Jul 8, 2013, 5:28:28 AM7/8/13
to nhu...@googlegroups.com
any news on the effort of compilling jetdriver with nhibernate 3 ?

Agelos panagiotakis

unread,
Jul 9, 2013, 5:13:52 AM7/9/13
to nhu...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages