Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    India
    Posts
    31

    Question Unanswered: DSN connection w/o password

    hi all


    i want to connect to SQL Server using DSN.

    I create a System DSN, say 'DSN_PWD', provide SQL server authentication in that step and test the connection which works fine.

    Now, currently i am using a code by my seniors which is as below

    Code:
    Dim objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open  "DSN_PWD","username","password"
    objConn.Close
    Set objConn =Nothing

    what i am concerned is that this will be saved as ASP file, i don't want any login informatoin to be saved in a physical file openly.

    i have tried this but it gives error



    Code:
    Dim objConn
    Set objConn = Server.CreateObject("ADODB.Connection")
    
    objConn.ConnectionString="DSN=DSN_PWD;"
    objConn.Open 
    
    objConn.Close
    Set objConn =Nothing
    Error
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user

    is there any effective way?

    Thanks all

    Yogesh Jangam
    Do not walk behind me, for I may not lead.
    Do not walk ahead of me, for I may not follow.
    Do not walk beside me, either.
    Just leave me alone.

    Yogesh Jangam
    http://yogeshjangam.blogspot.com

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You can hardcode the username and the password within the DSN itself using the ODBC Connection Manager. Is that what you want?

    -PatP

  3. #3
    Join Date
    Jan 2004
    Location
    India
    Posts
    31

    Smile DSN is ok...

    my primary concern being security, i don't want any SQL login information to be saved in any ASP files.

    I am creating DSN with SQL Authentication with Login ID/PWD entered by user

    i want a method to use this DSN to create an ADODB.Connection w/o manually again typing username and password in objConn.open method

    i hope i am clear ;-).........

    i have looked for connection code, but most of them have login info in the Open method.

    Thanks
    Yogesh Jangam
    Do not walk behind me, for I may not lead.
    Do not walk ahead of me, for I may not follow.
    Do not walk beside me, either.
    Just leave me alone.

    Yogesh Jangam
    http://yogeshjangam.blogspot.com

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    The easiest way to do this is if your IIS service runs as an NT account. Then just use Windows Authentication for your ODBC connection and you are "good to go" without any fuss at all.

    If you must run your IIS Service as LocalSystem, then you need to butcher a DSN to force static SQL authentication. That would be a last resort.

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •