Error with ConnectionString
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
Comments are currently closed for this discussion. You can start a new one.
2 Posted by CGoldie on 10 May, 2010 09:48 AM
Found the problem - it was with our application code - not Fluent Nhibernate.
Cheers
James Gregory resolved this discussion on 16 May, 2010 05:04 PM.