ADD ODBC database via batch file with Username/password

13,772

http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/53f689c1-53c8-45c6-b9ce-c44bce46cd9d/ says "Persistence of login credentials in a DSN is not supported (it's insecure). Using trusted connection would be the best way to achieve connecting without specifying credentials since the logged on user credentials is used for authenticating to the server."

If you change to Trusted_Connection=No it will add the DSN, but you'll then need to run the ODBC Data Source Admin and add the user and pwd to the new DSN by hand.

btw, according to http://msdn.microsoft.com/en-us/library/windows/desktop/ee388579%28v=vs.85%29.aspx "ODBCCONF.exe will be removed in a future version of Windows Data Access Components. Avoid using this feature, and plan to modify applications that currently use this feature."

Share:
13,772
Glen Morse
Author by

Glen Morse

Updated on June 05, 2022

Comments

  • Glen Morse
    Glen Morse about 2 years

    I need to install an ODBC database on a few computers and was hopeing to do it all via a batch file. I can get it to install the database connection string like so.

    ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=DSNNAME | Description=Descriptionname| SERVER=ServerName | Trusted_Connection=Yes | Database=dbname"
    
    pause
    @CLS
    @Exit
    

    But i need to add that it should log in with with an Login ID and password NOT with the network login ID.

    Anyone know how i can fix this? also its on 64 bit windows 7 Thanks