Hi,
I am using the Jet dialect from the 1.0.2 contrib package and am getting an exception stating that the database cannot be found, but it is not using the database that I have specified in the config file.
I load my configuration from a separate NHibernate.config XML file with a call to Configuration.Configure() via a generic NHibernate helper class and this works fine with the SQL Server dialect.
The log file seems to indicate that the configuration settings are being picked up correctly:
10:20:07.703 [TestRunnerThread] INFO NHibernate.Cfg.Environment - NHibernate 1.0.2
10:20:07.718 [TestRunnerThread] INFO NHibernate.Cfg.Environment - nhibernate section not found in application configuration file
10:20:07.718 [TestRunnerThread] INFO NHibernate.Cfg.Environment - Using reflection optimizer
10:20:08.125 [TestRunnerThread] DEBUG NHibernate.Cfg.Configuration - connection.provider=NHibernate.Connection.DriverConnectionProvider
10:20:08.125 [TestRunnerThread] DEBUG NHibernate.Cfg.Configuration - connection.driver_class=NHibernate.JetDriver.JetDriver, NHibernate.JetDriver
10:20:08.125 [TestRunnerThread] DEBUG NHibernate.Cfg.Configuration - connection.connection_string=Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=D:\Data\TheProspectShop\Website\TheProspectShop.mdb
10:20:08.125 [TestRunnerThread] DEBUG NHibernate.Cfg.Configuration - show_sql=false
10:20:08.125 [TestRunnerThread] DEBUG NHibernate.Cfg.Configuration - dialect=NHibernate.JetDriver.JetDialect, NHibernate.JetDriver
10:20:08.125 [TestRunnerThread] DEBUG NHibernate.Cfg.Configuration - query.substitutions=true 1, false 0, yes 'Y', no 'N'
10:20:08.125 [TestRunnerThread] DEBUG NHibernate.Cfg.Configuration - cache.use_query_cache=true
10:20:08.125 [TestRunnerThread] DEBUG NHibernate.Cfg.Configuration - hibernate.cache.provider_class=NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache
10:20:08.125 [TestRunnerThread] DEBUG NHibernate.Cfg.Configuration - TheProspectShop<-TheProspectShop.Domain
10:20:08.125 [TestRunnerThread] INFO NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: TheProspectShop.Domain
10:20:08.125 [TestRunnerThread] INFO NHibernate.Cfg.Configuration - Found mapping documents in assembly: TheProspectShop.Domain.Datacard.hbm.xml
10:20:08.234 [TestRunnerThread] INFO NHibernate.Dialect.Dialect - Using dialect: NHibernate.JetDriver.JetDialect
However, when I try to get an object via the Session, an exception gets thrown:
10:20:09.375 [TestRunnerThread] DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining IDbConnection from Driver
10:20:09.656 [TestRunnerThread] DEBUG NHibernate.Util.ADOExceptionReporter - SQL Exception
System.Data.OleDb.OleDbException: Could not find file 'D:\Development\DotNet\TheProspectShop\NUnit\bin\Debug\dbo.mdb'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at NHibernate.JetDriver.JetDbCommand.System.Data.IDbCommand.ExecuteReader()
at NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session)
As you can see, the database being used is not correct and appears to be a default name as if it is not finding anything in the configuration settings.
Not sure what I am doing wrong here so would appreciate some assistance.
Thanks,
Jason
|