Hi experts, any help appreciated!
An ASP-Net-WebService reads Data from an Access-mdb via NHibernate. Normally all works fine, the WebService is called, reads from the database, does its work and returns the data.
But when use MS-Access to edit some data and call the WebService with Access still open the WebService throws the following exception:
2010-10-25 16:13:29 DEBUG NHibernate.Util.ADOExceptionReporter - SQL Exception System.Data.OleDb.OleDbException: Could not use ''; file already in use. at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OleDb.OleDbConnection.Open() at NHibernate.JetDriver.JetDbConnection.Open() at NHibernate.Connection.DriverConnectionProvider.GetConnection() at NHibernate.AdoNet.ConnectionManager.GetConnection() at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd) at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd) at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session)
Here is the section of the web.config file: <session-factory> <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="connection.connection_string">Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[Path to my mdb]</property> <property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property> </session-factory>
MS-Access is configured to open files shared, so opening and editing the mdb with two instances of MS-Access works fine.
The WebService also works fine when I open the mdb with MS-Access in shared read-only-mode.
Therefore I think NHibernate tries to force an exclusive open. How can I tell NHibernate to open the mdb shared? Or is there another solution?
Thank you for your time (and hopefully for your help)! Martin
|