locked
Connection string for Sql Server Application User for Applications only RRS feed

  • Question

  •  I created an application and trying to deployed it on production environment , our database team give me the user and password for required database and says this is for application use only, I try to put the given information into the connection string and get login failed for user 'test' exception.

       I ask the DB team but they keep telling me that this is the correct user and password and you have to use it for this purpose.

    I seek help on this regards,

    Thanks

      


    Syed Danish Aftab http://www.danishaftab.net

    Tuesday, September 4, 2012 8:52 AM

Answers

  • But this regards Application Roles; to switch to this role context you still need to logon to SQL Server and for this you need a logon.

    You should clearify it with your DB team which login you should use and if you should switch to a application role.


    Olaf Helper
    Blog Xing

    • Marked as answer by Maggie Luo Sunday, September 30, 2012 12:05 PM
    Tuesday, September 4, 2012 10:19 AM
  • Hi Syed

    Can you ask your DBA team to have a look in SQL server error log to have complete details about login failures. You can check & sahre the state of login failure error message details to have particular reason of login failure.

    Most possible reasons :-

    • SQL server is configured to run only on windows authentication, need to switch to mixed mode
    • User is not having access on target database
    • Password provided is incorrect

    Please click the Mark as Answer or Vote As Helpful if a post solves your problem or is helpful!

    • Marked as answer by Maggie Luo Sunday, September 30, 2012 12:06 PM
    Tuesday, September 4, 2012 1:40 PM

All replies

  • Hello Syed,

    How does your connection string look like (of course without the clear password)?
    Which exact error message do you get?

    Please have also a look at http://www.connectionstrings.com/sql-server-2008 for valid connection strings.


    Olaf Helper
    Blog Xing

    Tuesday, September 4, 2012 9:03 AM
  • This is my connection string

    <add key="ConnectionString" value="Data Source=DBServer;Initial Catalog=MDM;User Id=Usr;Password=*******"/>

    This is the error I am getting

    "Login failed for user 'MDM'."

    DB Team say this user is only allow you to connect from application.


    Syed Danish Aftab http://www.danishaftab.net

    Tuesday, September 4, 2012 9:26 AM
  • DB Team say this user is only allow you to connect from application

    Hello Syed,

    Then the DB team should clearify, what they exactly mean with.

    It's maybe possible that they created a logon trigger which validates the login + application name. If so you have to may add the application name in your connection string like:

    <add key="ConnectionString" value="Data Source=DBServer;Initial Catalog=MDM;User Id=Usr;Password=*******";APP=YourAppName/>


    Olaf Helper
    Blog Xing

    Tuesday, September 4, 2012 9:34 AM
  • I go through some forums found this I think they might referring to Application Logins.

    http://social.msdn.microsoft.com/forums/en-us/sqlsecurity/thread/2B500C62-D1BE-4E4C-A59A-4C5FD7E7F260


    Syed Danish Aftab http://www.danishaftab.net

    Tuesday, September 4, 2012 10:12 AM
  • But this regards Application Roles; to switch to this role context you still need to logon to SQL Server and for this you need a logon.

    You should clearify it with your DB team which login you should use and if you should switch to a application role.


    Olaf Helper
    Blog Xing

    • Marked as answer by Maggie Luo Sunday, September 30, 2012 12:05 PM
    Tuesday, September 4, 2012 10:19 AM
  • This is the error I am getting

    "Login failed for user 'MDM'."

    DB Team say this user is only allow you to connect from application.

    Ask the DB team to provide the related message from the SQL Server errorlog.  That message will include additional details about the reason for the error.

    I assume you have obfuscated the connection string since the user name in the error message is the database name rather than the user name.


    Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/

    Tuesday, September 4, 2012 10:33 AM
  • Hi Syed

    Can you ask your DBA team to have a look in SQL server error log to have complete details about login failures. You can check & sahre the state of login failure error message details to have particular reason of login failure.

    Most possible reasons :-

    • SQL server is configured to run only on windows authentication, need to switch to mixed mode
    • User is not having access on target database
    • Password provided is incorrect

    Please click the Mark as Answer or Vote As Helpful if a post solves your problem or is helpful!

    • Marked as answer by Maggie Luo Sunday, September 30, 2012 12:06 PM
    Tuesday, September 4, 2012 1:40 PM