Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am using sql server 2008 for my database. I tested the connection using the data link properties with a success. The connection string from the data link properties looks like this
CSS
[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=DServices;Initial Catalog=MDClone;Data Source=localhost


I run an application as service which connects to this db. In its .config file the connection string looks like this
XML
<connectionStrings>
        <add name="DConnectionString"
              connectionString="Data Source=localhost;Persist Security Info=False;Initial Catalog=MDClone;User Id=DServices;Password=xxx;
              providerName="System.Data.SqlClient"/>
    </connectionStrings>


There is a password which I am hiding for confidentiality.

After I start the service, I looked at the event viewer to find this error.

MSIL
[ 10] ERROR Monitor.TaskHostHeartbeat.Start: Unexpected error: System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'DServices'.



The same userid and password worked in the data link properties. But not in config file.
Is there something that I am missing.

Thanks in advance.
Posted

can you please remove the "Persist Security Info=False" and try
 
Share this answer
 
Comments
[no name] 22-Jun-11 11:51am    
good thought
manumith 22-Jun-11 12:51pm    
I tried that already. Didn't work!
Are you sure that the Application runs from the same machine where the SQL Server runs? It's better to provide IP or machine name instead of localhost.

localhost works fine only if the SQL Server and application runs from the same machine.


Mark it as answer if it is helpful
 
Share this answer
 
Comments
[no name] 22-Jun-11 11:50am    
sometimes it will workout
manumith 22-Jun-11 12:52pm    
They are on the same machine. But anyway. I'll try adding the machine name instead of localhost.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900