Creating an ODBC data source from the command line

You can create User and System Data Sources using the dbdsn utility. You can not create File Data Sources using this utility. System Data Sources are limited to Windows operating systems only, and you can use the ODBC Administrator to create File Data Sources.

Caution

Storing user IDs, passwords (encrypted or unencrypted), and/or database keys in a data source is not secure. It is recommended that you do not store this information in a data source if the database contains sensitive data.

To create an ODBC data source (Command line)

  • Run a dbdsn command, specifying the connection parameters you want to use.

    For example, the following command creates a data source for the sample database. The command must be entered on one line:

    dbdsn -w "My DSN" "UID=DBA;PWD=sql;DBF=samples-dir\demo.db"

    For information about samples-dir, see Samples directory.

For more information about the dbdsn utility, see Data Source utility (dbdsn).

Creating a System ODBC data source on 64-bit Windows

Unlike the User Data Source, 64-bit versions of Windows maintain two separate sets of the System Data Source collection, one set for 64-bit applications and one set for 32-bit applications. If you want to create a System Data Source that is accessible to both 64-bit and 32-bit applications, you must also run the 32-bit version of dbdsn (located in the SQL Anywhere bin32 folder). Make sure that your 32-bit System Data Source is set up exactly like your 64-bit System Data Source to avoid connection problems or confusion.