Problem accessing MySql database through DSN

29 views
Skip to first unread message

Daniel Lidström

unread,
Aug 31, 2010, 4:56:26 AM8/31/10
to Fluent NHibernate
Hello,

I am a complete newbie trying out Fluent NHibernate for the first
time. What I want to do is configure FNH to connect to the database
specified in my app.config. That file looks like this:

<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/
>
</startup>
<connectionStrings>
<add name="ConnStr" connectionString="DSN=NextStep;"/>
</connectionStrings>
</configuration>

I have installed the MySql connector for .NET and reference the
MySql.Data assembly. It is set to copy local.
Here's the configuration part of my program:

Program.cs:
private static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(MySQLConfiguration.Standard.ConnectionString(c
=> c.FromAppSetting("ConnStr")))
.Mappings(m =>
m.FluentMappings.AddFromAssemblyOf<GateCmd>())
.BuildSessionFactory();
}

GateCmd is located in a referenced assembly that also contains the
GateCmdMap class.

Running the CreateSessionFactory method results in an exception:

FluentNHibernate.Cfg.FluentConfigurationException: An invalid or
incomplete configuration was used while creating a SessionFactory.
Check PotentialReasons collection, and InnerException for more detail.

---> MySql.Data.MySqlClient.MySqlException: Access denied for user
''@'localhost' (using password: NO)
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.Authenticate411()
at MySql.Data.MySqlClient.NativeDriver.Authenticate()
at MySql.Data.MySqlClient.NativeDriver.Open()
at
MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder
settings)
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at NHibernate.Connection.DriverConnectionProvider.GetConnection()
at
NHibernate.Tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.Prepare()
at
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect
dialect, IConnectionHelper connectionHelper)
at
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory
sessionFactory)
at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg,
IMapping mapping, Settings settings, EventListeners listeners)
at NHibernate.Cfg.Configuration.BuildSessionFactory()
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
in d:\Builds\FluentNH\src\FluentNHibernate\Cfg
\FluentConfiguration.cs:line 93
--- End of inner exception stack trace ---
at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
in d:\Builds\FluentNH\src\FluentNHibernate\Cfg
\FluentConfiguration.cs:line 98
at DomainModel.Test.Program.CreateSessionFactory() in C:\Users
\Daniel\Programming\DomainModel\DomainModel.Test\Program.cs:line 39
at DomainModel.Test.Program.Main(String[] args) in C:\Users\Daniel
\Programming\DomainModel\DomainModel.Test\Program.cs:line 18

I don't know how to proceed. The specified DSN (NextStep) has a
username and password already specified. What am I missing here?

Thanks in advance!

Regards,

Daniel Lidström
Stockholm, Sweden

Daniel Lidström

unread,
Aug 31, 2010, 5:43:08 AM8/31/10
to Fluent NHibernate
I forgot to mention that I am running Windows 7 64-bit.

Daniel
Reply all
Reply to author
Forward
0 new messages