Developer forum

Forum » Development » connection error

connection error


Reply

Hej


 


Jeg har et projekt som er flyttet til en anden udviklingsmaskine og nu kan jeg ikke få adgang til sql serveren ?


 


Jeg har checket at connection data i globalsettings er ok ved hjælp af SQL server Management Studio fra den samme maskine og der kan jeg fint etablere forbindelse.


 


Fejlen er:


 


Please wait!

The SQL-Server database 'Dynamic.mdb' could not be opened - the error is: 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.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at Dynamicweb.Database.GetConn(String strDatabase)


 


Jeg har ikke den fjerneste idé om hvad der kan være galt, så jeg håber at der måske er en barmhjertig sjæl der har oplevet det samme som kan lede mig i den rigtige retning.


 


mvh


Lars Kohsel


Replies

 
Reply

Please keep postings in English.


 


The message makes a pretty clear point:


 


"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."


 


However, this error may also be produced if you restore the database and neglect to create new login for the database. If the database is only being restored, the db user may be restored as well but an SQL server login must be created seperately.


 


The best way to test if this is the issue is to attempt to connect to the database through Management Studio with the current login. If you can't connect, create a completely new login, with user mappings datareader, datawriter and ddladmin to your database. Try connection again.


 


If this doesn't work, feel free to post a follow up here - in English, please:)

 
Reply
Sorensen wrote:


Please keep postings in English.




 




The message makes a pretty clear point:




 




"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."




 




However, this error may also be produced if you restore the database and neglect to create new login for the database. If the database is only being restored, the db user may be restored as well but an SQL server login must be created seperately.




 




The best way to test if this is the issue is to attempt to connect to the database through Management Studio with the current login. If you can't connect, create a completely new login, with user mappings datareader, datawriter and ddladmin to your database. Try connection again.


 


That is excactly what I did as I wrote in my email (in danish). Please advice for further tests.



regards

Lars Kohsel


 




If this doesn't work, feel free to post a follow up here - in English, please:)



 
Nicolai Høeg Pedersen
Reply

Do you enable TCP protocol on our own client machine?


If you only enable Named Pipes on your client and NP is disabled on the server, you can have this problem. Use sql server client utility to check whether TCP is enabled.


c:\windows\system32\cliconfg.exe


 


Or vice versa.


 


If you are using the IP to connect, try the servername. If you use the servername, try the IP address.


 


Other things you can try related to that:


- Enable the TCP/IP protocol using the Surface Area Configuration Utility

- Make sure the TCP/IP protocol is enabled in the SQL Server Configuration Utility

- Make sure the SQL Server browser is started. Note this step is optional. It is possible to set the SQL Server instance to use a fixed IP address - but this is non-standard for named instances

- Make sure SQL Server and SQL Server Browser are exempted by the firewall on the server machine. This is done by putting sqlservr.exe and sqlbrowser.exe as an exception in the windows firewall.


Note: In order to get things to work. You might need to completely reboot the server machine after making the changes.


 


Also take a look at this one:


http://blogs.msdn.com/sql_protocols/archive/2005/10/22/483684.aspx


 


 

You must be logged in to post in the forum