Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# Blackred 1/7/2008 5:52 PM (edited 1/7/2008 5:53 PM)
Hello,

Can anyone tell me what I'm doing wrong here? This is the section in properties.config for my Sql Server connection...
[connectionString]Server=.\SqlExpress; Database=CubAid; Uid=CubAid; Pwd=password;[/connectionString]
[nhibernateDriver]NHibernate.Driver.SqlClientDriver[/nhibernateDriver]
[nhibernateDialect]NHibernate.Dialect.MsSql2000Dialect[/nhibernateDialect]

(the square brackets have been changed to allow me to post it)

But it just gives me a Login failed error. I know the username and password are correct so what else could be the problem?

Thanks,
Blackred


Here is the full error...
Server Error in '/' Application.
Login failed for user 'CubAid'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'CubAid'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Login failed for user 'CubAid'.]
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +435
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   NHibernate.Connection.DriverConnectionProvider.GetConnection() +71

[ADOException: Could not create connection from Driver]
   NHibernate.Connection.DriverConnectionProvider.GetConnection() +119
   NHibernate.Impl.SessionFactoryImpl.OpenConnection() +29

[ADOException: cannot open connection]
   NHibernate.Impl.SessionFactoryImpl.OpenConnection() +83
   NHibernate.Impl.SessionImpl.get_Connection() +32
   NHibernate.Impl.BatcherImpl.Prepare(IDbCommand command) +105
   NHibernate.Impl.BatcherImpl.ExecuteReader(IDbCommand cmd) +24
   NHibernate.Loader.Loader.GetResultSet(IDbCommand st, RowSelection selection, ISessionImplementor session) +175
   NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies) +243
   NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Object optionalObject, Object optionalId, Object[] optionalCollectionKeys, Boolean returnProxies) +65
   NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet querySpaces, IType[] resultTypes) +169
   NHibernate.Hql.QueryTranslator.List(ISessionImplementor session, QueryParameters queryParameters) +64
   NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters) +200

[ADOException: Could not execute query]
   NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters) +255
   NHibernate.Impl.QueryImpl.List() +84
   NHibernate.Impl.AbstractQueryImpl.UniqueResult() +7
   Cuyahoga.Core.DataAccess.SiteStructureDao.GetSiteAliasByUrl(String url) in C:\Prvt\CubAid\Core\DataAccess\SiteStructureDao.cs:56
   ProxyInterfaceDataAccessSiteStructureDao_ISiteStructureDao_ISerializable.callback__GetSiteAliasByUrl(String ) +10
   __delegate_2.Call(Object[] ) +52
   Castle.Windsor.Proxy.DefaultMethodInvocation.Proceed(Object[] args) +164
   Castle.Facilities.AutomaticTransactionManagement.TransactionInterceptor.Intercept(IMethodInvocation invocation, Object[] args) +169
   Castle.Windsor.Proxy.DefaultMethodInvocation.Proceed(Object[] args) +123
   Castle.Windsor.Proxy.InterceptorChain.Intercept(IMethodInvocation invocation, Object[] args) +182
   ProxyInterfaceDataAccessSiteStructureDao_ISiteStructureDao_ISerializable.GetSiteAliasByUrl(String url) +105
   Cuyahoga.Core.Service.SiteStructure.SiteService.GetSiteAliasByUrl(String url) in C:\Prvt\CubAid\Core\Service\SiteStructure\SiteService.cs:49
   Cuyahoga.Web.UI.PageEngine.OnInit(EventArgs e) in C:\Prvt\CubAid\Web\UI\PageEngine.cs:159
   System.Web.UI.Control.InitRecursive(Control namingContainer) +321
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +834


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 
# martijnb 1/7/2008 6:52 PM
Check if SQL Express allows remote connections and if mixed mode authentication is turned on.
# Blackred 1/7/2008 7:27 PM
Thanks for the speedy reply! I have remote connections turned on and it does allow SQL and Windows authentication.

This is a brand new dedicated server and a new install of Sql Server Express. I have enabled MSDE / MS SQL in the computers Local Security Policy.

I can connect fine through the Express Management Studio which is why I thought it was a config problem, does it matter that the nhibernateDialect is using MsSql2000Dialect? Is there a 2005 equivilent?
# Blackred 1/7/2008 9:02 PM
Hello,

I have it working now. It appears as if it was caching the connectionString somewhere; I changed the password and updated properties.config but it didn't catch on. I noticed it was doing this when I changed the connection string to use a Trusted Connection and it still gave me the "Login failed for user" message!

When updating the web.config it appears to have cleared the cache and started using the connection string that works.

Thanks for the help, but there was no *real* problem, although it is very strange that it would cache the connection string.

Blackred.
# martijnb 1/7/2008 10:21 PM
Now you're mentioning properties.config: I forgot about the fact that a change here doesn't automagically recycle the ASP.NET process like after a change in web.config.
The only reason I haven't run into this is probably due to the fact that a change in properties.config mostly comes together with a fresh set of dll's.

So thanks for finding this one. In the past, some more people have had strange issues with connecting. Those issues we're all solved after a while, but I think, lots of them could have been solved quicker with this knowledge.