DSN's user ID & password for SQL Server


  • 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?
    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.



    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:


    If you can figure it out, let me know.


    Sunday, September 10, 2006 4:53 AM