0

I have the following exception when trying to open a connection to the server since last week.

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
  • I'm using MSSQL Server 2008 Express
  • Allow remote connections is checked
  • My application,SSMS and the server are in the same computer
  • I can connect to the database from SSMS
  • I used to be able to connect to the server one week ago. The only change is the modification of settings : recovery option of first failure , seconde failure and subsequent failure to "Restart the Service" on the properties windows of Sql Server services.
  • I am not admin of my computer and can't have it except when a support take the hand on my computer
  • connection string :

    Provider=SQLOLEDB;Data Source=ComputerName\SQLEXPRESS;Initial   Catalog=DatabaseName;Integrated Security=SSPI
    
  • Shared Memory, Named pipes tcp/ip are enabled both for protocol for SQLEXPRESS and "Client Protocols".
  • the only differences I can find between the "before" error log and the "after" is :

    Dedicated administrator connection support was not started because it is disabled on this edition of SQL Server. If you want to use a dedicated administrator connection, restart SQL Server using the trace flag 7806. This is an informational message only. No user action is required.
    2013-04-15 19:13:27.98 Serveur     The SQL Server Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x490, state: 16. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.
    2013-04-15 19:13:28.53 spid10s     Erreur : 1802, Gravité : 16, État : 4.`
    

Thanks for your time.

2
  • try using localhost\sqlexpress in the connection string
    – DanBig
    Apr 23, 2013 at 16:09
  • Also, i have the exact same configuration on another computer ( local db with local access) and it works (until now. I fear that i will also lost it after a restart or whatever). The only difference is the "Allow service to interact with desktop" checked on the log on tab of service property of sql server.
    – FabricePA
    Apr 23, 2013 at 16:54

2 Answers 2

0

What is your application written with? Visual Studio?

Where does your connection string come from? Doesn't look like what Visual Studio is generating.

Change your connection string to Data Source=ComputerName\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=True

Edit :

OK, so you're using Visual Studio. Go in the Server Explorer tab and add a connection to your SQL server, add a DBML file to your project (don't have Visual Studio here, but it's called Linq to SQL classes I think), then pull whatever table from your server in the DBML and save. This wlll make Visual Studio create a connection string automatically. Then go in the project properties, settings tab, and check what the connection string looks like.

1
  • My application is written in C# with VS2010. I tried the connection string Data Source=ComputerName\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=True and localhost\sqlexpress with no success. Same error for localhost, No error message available, result code: DB_E_ERRORSOCCURRED(0x80040E21 for the security = true. My connection string comes from a connection string help site
    – FabricePA
    Apr 23, 2013 at 16:46
0

Ok so user2210761 leads me to a temporary solution.

I figured out server explorer is using this kind of connection string Data Source=ComputerName\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=True

Nevertheless, this connection string isn't compatible with Ole DB connection class. ( i was using OleDbConnection and all the object tree associated to it) because it needs a provider value.

As i absolutely need to connect to my DB , i've switched to SqlConnection class and i set the server explorer connection string and it works!

I wiil consider again the connection string when i will have a real DB.

Thanks user2210761 for your help!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .