-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Incorrect database name when using Jet dialect
PostPosted: Tue May 09, 2006 8:33 pm 
Senior
Senior

Joined: Sat Sep 03, 2005 12:54 am
Posts: 139
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 10, 2006 10:12 am 
Newbie

Joined: Tue May 31, 2005 11:19 pm
Posts: 11
Location: Brisbane, Australia
Try checking your hibernate.config file and all .hbm.xml mapping files for 'schema=dbo' settings and remove them.

This setting prefixes your table names in generated SQL like this:
select name from dbo.person

I found that access doesn't like this.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 10, 2006 5:27 pm 
Senior
Senior

Joined: Sat Sep 03, 2005 12:54 am
Posts: 139
FANTASTIC...problem solved.

Thanks a lot Brendan.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.