Interview Question in Data Management


 

Interview Question :: Unable to connect to SQL Server database


Hi guys, when i set up ASP.NET SQL in SQL Server 2005 i got this error.
You guys know y? Can you guys help me out ? Thx in advance

Setup failed.

Exception:
Unable to connect to SQL Server database.

--------------------------------------...
Details of failure
--------------------------------------...

System.Web.HttpException: Unable to connect to SQL Server database. ---> System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
at System.Data.SqlClient.SqlInternalConnect... exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExc... stateObj)
at System.Data.SqlClient.TdsParser.Connect(... serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnect... serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnect... host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnect... owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnect... identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFacto... options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFac... owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPoo... owningObject)
at System.Data.ProviderBase.DbConnectionPoo... owningObject)
at System.Data.ProviderBase.DbConnectionPoo... owningObject)
at System.Data.ProviderBase.DbConnectionFac... owningConnection)
at System.Data.ProviderBase.DbConnectionClo... outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open...
at System.Web.Management.SqlServices.GetSql... server, String user, String password, Boolean trusted, String connectionString)
--- End of inner exception stack trace ---
at System.Web.Management.SqlServices.GetSql... server, String user, String password, Boolean trusted, String connectionString)
at System.Web.Management.SqlServices.SetupA... server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install)
at System.Web.Management.SqlServices.Instal... database, SqlFeatures features, String connectionString)
at System.Web.Management.ConfirmPanel.Execu...
Answers to "Unable to connect to SQL Server database"
RE: Unable to connect to SQL Server database?

If I'm not mistaken, when you set up SQL 2005, there is a "Surface Area" setting, or something like that, that allows you to select TCP/IP, named pipes, or both. You need to make sure you have "both" selected.

I think you can also go into the configuration manager, expand "Client Protocols," and check that they are both enabled there.

Try that and see if it helps. Good luck : )
 
Vote for this answer ::  
Update Alert Setting