Archive: Setting password of a DSN (ODBC)


Setting password of a DSN (ODBC)
Hello, I have been trying to create a System DSN connection using ODBC. Right now i use the registry and it works fine when i am not using a password for the logon credentials.

The password is not set in the registry for SQL connections so i have a problem :(. I´ve been searching trying to find some VBscripts for doing this. I have also looked into this:

system::call 'odbccp32.dll::SQLConfigDataSourceA(i 0, i ${ODBC_ADD_DSN}, t "driver", t "attributes") i'

But i can´t find any way to set the password in the "attributes" part.

Can anyone help me?


Are you sure that's possible? Are you sure it's not required to use the password only when connecting?


No I am not sure. But if I can create this DSN manually I think it should be possible to do it with a VBscript or somethink like that. I thought someone else would have wanted to create a DSN to a SQL server that uses better then blank passwords.. ;) I also found this plugin: NsODBC but i cant find ANY documentation on it.

What do you think i should do?


You do use a password when setting up DSNs (or at least with MS SQL Server).


Well, it seems that every database type accepts different parameters for SQLConfigDataSource. According to MSDN, MS SQL doesn't accept a password there and only in SQLDriverConnnect. The Paradox driver, however, does accept PWD=password. Maybe it'll work with SQL Server as well...


I did some reading on what is required when creating a DSN and it seems like the user and password is only used for testing that all the other values entered are correctly. The password you enter in the wizard is not used anywhere except when testing the connection. So my problem is solved by doing nothing :)