I don't like odbc.ini in the same directory as my PHP or Perl script, as the file contains passwords. What do I do?

Add your data source to /etc/odbc.ini instead. Or, specify a different file by setting and exporting ODBCINI. To do this from PHP, use:

putenv ("path/odbc.ini");

To check what environment variables are set in PHP, use phpinfo();.

You can also place sensitive information in the SQLDriverConnect function's in_connection_string parameter. For example:

SQLDriverConnect(dbc,
 "DSN=dsn_name;LOGONUSER=username;LOGONAUTH=password;",…);

Attribute values set in in_connection_string override values set in odbc.ini.