Error with ConnectionString

Original Post CGoldie's Avatar

CGoldie

08 May, 2010 09:04 AM via web

When I attempt to configure a connection to the database using a user ID and password I get an error "Login failed for user X" when NHibernate attempts to use the connection:

Here's how I am attempting to confgure the database connection:

MsSqlConfiguration.MsSql2005

             .ConnectionString(c => c.FromAppSetting("DbConnection"));

My App.config has this:

<add key="DbConnection" value="Data Source=MyDBServer;Initial Catalog=MyDb;User ID=x;Password=y"/>

However if I change my App.Config bBConnection property to use integrated security everything works fine!.
i.e. my app.config now looks like this:

<add key="DbConnection" value="Data Source=MyDBServer2;Initial Catalog=MyDb;Integrated Security=true;"/>

Also if instead of using the 'FromAppSetting' method to configure the connection string if I use the MsSqlConnectionStringBuilder Username/Password methods then I don't get any errors either.

i.e.
MsSqlConfiguration.MsSql2005

             .ConnectionString(c => c
                                         .Server("MyDBServer")
                                         .Database("MyDB")
                                         .Username("X")
                                         .Password("Y")

Any ideas? I'm trying to use the FromAppSetting method because I want to specify properties such as 'Connect Timeout' and 'Max Pool Size' which do not exist as methods on MsSqlConnectionStringBuilder.

I'm using fluent nhibernate 1.0.0.593.

Thanks

  1. 2 Posted by CGoldie on 10 May, 2010 09:48 AM

    CGoldie's Avatar

    Found the problem - it was with our application code - not Fluent Nhibernate.

    Cheers

  2. James Gregory resolved this discussion on 16 May, 2010 05:04 PM.

Comments are currently closed for this discussion. You can start a new one.

Recent Discussions

05 Jul, 2010 10:29 PM
05 Jul, 2010 12:45 PM
05 Jul, 2010 12:42 PM
05 Jul, 2010 12:17 PM
05 Jul, 2010 12:12 PM

 

03 Jul, 2010 12:26 AM
02 Jul, 2010 02:17 PM
02 Jul, 2010 08:18 AM
02 Jul, 2010 12:20 AM
01 Jul, 2010 10:14 PM