Connecting with an ODBC data source (command line)

To connect to a database using an ODBC data source, use the DataSourceName (DSN) connection parameter.

Prerequisites

An ODBC data source for the database that you want to connect to.

The SQL Anywhere 12 Demo data source is configured to start the database server and database if they are not already running. If your ODBC data source is not configured to start the database and database server, then you must start them. For example, run the following command to start the SQL Anywhere 12 sample database:

dbeng12 -n demo12 "%SQLANYSAMP12%\demo.db"

Context and remarks

Note

If a connection string and an ODBC data source both specify the same connection parameter, the value from the connection string is used and the value from the data source is ignored. See Connection parameter syntax rules.

 Connecting with an ODBC data source (command line)
  • Run the following command to connect using the ODBC data source name:

    dbisql -c "DSN=SQL Anywhere 12 Demo"

    Interactive SQL starts and connects to the sample database.

    Note

    You do not need to enter a user ID and a password for this connection because the SQL Anywhere 12 Demo data source already contains this information.

    In a production environment, it is recommended that you do not store passwords in an ODBC data source. See Do not include passwords in ODBC data sources.

Results

The application connects to the sample database.

Next

None.

 See also