Introducing SQL Anywhere Studio
Tutorial: Connecting to the Sample Database
The Open Database Connectivity (ODBC) interface is defined by Microsoft Corporation, and is a standard interface for connecting client applications to database-management systems in Windows environments. Connections are made by specifying connection parameters. It is often convenient to collect a set of connection parameters together and store them in an ODBC data source.
You can connect to Adaptive Server Anywhere databases using ODBC data sources from Interactive SQL, Sybase Central, PowerDesigner, InfoMaker, and all the Adaptive Server Anywhere utilities.
Adaptive Server Anywhere supports several programming interfaces in addition to ODBC. You can use ODBC data sources to connect to Adaptive Server Anywhere—not only from ODBC applications, but also from embedded SQL applications, such as the administration utilities, and from Interactive SQL and Sybase Central—even though these applications do not use ODBC. The functionality to process ODBC data sources is built into the embedded SQL client library, and into Sybase Central and Interactive SQL.
In this lesson, we show how to create an ODBC data source.
Create an ODBC data source
Start the ODBC Administrator.
From the Windows Start menu, choose Programs
The ODBC Data Source Administrator appears, displaying a list of the data sources you currently have installed on your machine:
On the User DSN tab, click Add.
Select Adaptive Server Anywhere 9.0 from the list of drivers, and click Finish.
The Adaptive Server Anywhere ODBC Configuration dialog appears.
Many of the fields in this dialog are optional. Click the question mark at the top right of the window and click an entry field to find more information about that field. For many purposes only need to use a few parameters. The following data source parameters are sufficient for the Adaptive Server Anywhere sample database:
Data Source Name (ODBC tab) This is the name that appears in the Connect dialog. It can contain spaces, but should be short.
Enter the name My Sample DSN.
User ID (Login tab) The database user ID you will use to connect. If you omit the user ID, you will be prompted for it when you attempt to connect.
The default user ID for Adaptive Server Anywhere databases is DBA. Enter this as the user ID.
Password (Login tab) You should omit the password if there are security concerns with having passwords stored on your machine. If you omit the password, you are prompted for it when you attempt to connect.
The default user ID for Adaptive Server Anywhere databases has a password of SQL. Enter this as the password.
In production data sources, you may want to leave the user ID and password blank. The user is prompted to enter the information when they connect to the database.
Database File (Database tab) You can select a database file by browsing your machine.
Browse to your SQL Anywhere installation directory, and select the asademo.db file. This is the Adaptive Server Anywhere sample database.
When you have specified the parameters you need, click OK to create the data source and close the dialog box.
Start Interactive SQL and connect to the Adaptive Server Anywhere sample database using your new ODBC data source.
For a full description of database connections, see Connecting to a Database.
For more information about ODBC data sources, see Working with ODBC data sources.
For information about setting up ODBC data sources in UNIX, see Using ODBC data sources on UNIX.