locked
DSN's user ID & password for SQL Server

    Question

  • Hi,
    I setup a DSN which uses SQL as data source and chooses "With SQL Server authentication using a login ID and password entered by the user" option. The user ID and password are set in the DSN.
    I'd like to know how to connect the SQL Server through the DSN (ODBC connection) at runtime, without enter or hard code the user ID and password again as the users shouldn't know the user ID and password of the SQL Server. How to use or get the user ID and password has been set with the DSN?
    Thanks,
    ybc
    Saturday, September 09, 2006 11:51 PM

All replies

  •  

    You do this by making sure the server know about you as a user for server authentication and using a connection string.

    See www.connectionstrings.com

     

    Sunday, September 10, 2006 1:04 AM
  • The user ID and password shouldn't be hard coded in a connection string.

    Cheers,

    ybc

    Sunday, September 10, 2006 4:40 AM
  •  

    Did I say anything about doing that? I don't think so.

    I encrypt the connection string and save the encrypted string. I have several algorithms for doing this including saving an encrypted key in the program and decrypting the key and decrypting the encrypted string in the settings file.

    Here's what my connection string looks like in the settings file:

    "tRYnRKLvPDxzQ9Y/Apb1t/ntRpXa/PO2YgwySKT2B8k5Fo4SfSmH9FUtLtu4yfqfAILRDjMrpWvFKJn2g4fhc3MID/eA6Qi01N/bLCgoBSJay+UT8N2/oUVOw1NqlahdhHVWNh4RVtGdARrKVficg2ack9IcY2BE40trSZFVgh7/LJPqm4uQAg=="

    If you can figure it out, let me know.

    cheers

    Sunday, September 10, 2006 4:53 AM