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.  [ 5 posts ] 
Author Message
 Post subject: NHibernate 1.2.0.GA and MySql 5.0 connection dialect error
PostPosted: Thu Aug 30, 2007 1:49 pm 
Newbie

Joined: Thu Aug 30, 2007 1:36 pm
Posts: 3
I am unable to connect to MySql. My environment is Visual 2005, MySql 5.0, NHibernate 1.2.0.GA

I have followed all the steps in quick start/other examples
and also the http://www.hibernate.org/362.849.html

I get this error


Code:
Line 23:          {
Line 24:             Configuration config = new Configuration();
Line 25:             config.AddAssembly("NHibernateASPSample.Domain");
Line 26:             _sessionFactory = config.BuildSessionFactory();
Line 27:             if (_sessionFactory == null)


Source File: c:\NCBISearch\NHibernateASPSample\App_Code\SessionHelper.cs    Line: 25

Stack Trace:

[HibernateException: The dialect was not set. Set the property hibernate.dialect.]
   NHibernate.Dialect.Dialect.GetDialect() +127
   NHibernate.Dialect.Dialect.GetDialect(IDictionary props) +82
   NHibernate.Cfg.Configuration.AddValidatedDocument(XmlDocument doc, String name) +26


My Config file is below
Code:
<configSections>
    <section name="nhibernate" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
  </configSections>

  <nhibernate>
    <add key="hibernate.connection.provider"
      value="NHibernate.Connection.DriverConnectionProvider" />

    <add key="hibernate.dialect"
         value="NHibernate.Dialect.MySQL5Dialect" />
(also tried with MySqlDialect)

    <add key="hibernate.connection.driver_class"
         value="NHibernate.Driver.MySqlDataDriver" />

    <add key="hibernate.connection.connection_string"
         value="Server..."/>
  </nhibernate>


Can someone help.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 30, 2007 4:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
The dialet class is NHibernate.Dialect.MySQLDialect. Note all-caps SQL and no "5".

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 30, 2007 4:43 pm 
Newbie

Joined: Thu Aug 30, 2007 1:36 pm
Posts: 3
Thanks. I tried that. It does not work

The docs suggest to use the NHibernate.Dialect.MySQLDialect for MySQL 3 or 4
and for MySQL 5
NHibernate.Dialect.MySQL5Dialect

Any ideas.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 30, 2007 5:06 pm 
Hibernate Team
Hibernate Team

Joined: Tue Jun 13, 2006 11:29 pm
Posts: 315
Location: Calgary, Alberta, Canada
Ah... upon closer look, you are mixing the old style of configuration (using the <nhibernate> section) and the new style (using the hibernate.cfg.xml file). Change your config section to this:

Code:
   <configSections>
      <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.1.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
   </configSections>


The new style is implemented in the current trunk, it is not part of 1.2GA.

_________________
Karl Chu


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 31, 2007 2:36 pm 
Newbie

Joined: Thu Aug 30, 2007 1:36 pm
Posts: 3
Thanks it worked :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.