Creating and editing ODBC data sources

On Windows, the ODBC Administrator provides a central place for creating and managing ODBC data sources. The following procedure uses the ODBC Administrator to add a new data source to your existing odbc.ini, or creates a new file if necessary.

Sybase IQ also includes a cross-platform command-line utility named iqdsn to create data sources.

To create ODBC data sources on UNIX systems, see also “Using ODBC data sources on UNIX”.

Before you begin

This section describes how to create an ODBC data source. Before you create a data source, you need to know which connection parameters you want to include in it.

For more information, see “Simple connection examples” and “Assembling a list of connection parameters”.

In ODBC Administrator, you can work with User Data Sources, File Data Sources, and System Data Sources.

Creating a data source from the ODBC Administrator

StepsCreating an ODBC Data Source (ODBC Administrator)

  1. Start the ODBC Administrator:

    Select Settings > Control Panel > Administrative Tools > Data Sources (ODBC).

    or

    Programs > Sybase > ODBC Administrator

    The ODBC Data Source Administrator appears.

  2. Click Add.

    The Create New Data Source wizard appears.

  3. Select the Sybase IQ 12 from the list of drivers and click Finish.

  4. In the ODBC Configuration window, type the Data Source Name.

  5. Now click the Login tab. Type the User ID and Password for your database. For example, use “DBA” and “SQL”.

  6. Click the Database tab. If the data source is on your local machine, type the Server name, a Start line and Database file, including the path.

  7. If the data source is on a remote system, click the Network tab. Click the box for the appropriate protocol and specify the options beside the box. For example, to connect to a server on system PUSHKIN using TCP/IP protocol and port 1870, you would click TCP/IP and type:

    host=pushkin:1870
    

    You could also use the host network address. For example:

    host=157.133.66.75:1870
    
  8. Click OK when you have finished defining your data source.

    The ODBC Data Source Administrator returns you to the User DSN tab.

For details of the ODBC configuration box and its tabs, see “Configuring ODBC data sources”

NoteWhen specifying network connections, you need a different systemname:port# combination for each database server. The port number must match the one you started the server with.

Creating an ODBC data source from the command line

You can create User and System Data Sources using the iqdsn command-line utility. You cannot create File Data Sources with iqdsn. You can also use the ODBC Administrator to create User, System, and File Data Sources.

StepsCreating an ODBC data source (Command line)

  1. Open a command prompt.

  2. Enter an iqdsn command, specifying the connection parameters you wish to use. For example, the following command creates a data source for the Sybase IQ sample database. The command must be entered on one line:

    iqdsn -w "My DSN"
    "uid=DBA;pwd=SQL;dbf=c:\Program Files\Sybase\ASIQ-12_7\demo\asiqdemo.db"
    

    The iqdsn output contains the following line:

    User Data Source "My DSN" writen to registry.
    

The iqdsn utility lists Sybase IQ User Data Sources created on the Windows command line.

For more information on the iqdsn utility, see “Data Source utility (iqdsn)” in Sybase IQ Utility Guide.

StepsTesting an ODBC Data source

  1. Start the database. For example, to start the Sample Database, select Sybase > Adaptive Server IQ 12 > Start Sybase IQ Demo Database from the Programs menu.

  2. In the ODBC Data Source Administrator, select your new data source from the list of User Data Sources.

  3. Click Configure.

  4. On the ODBC Configuration dialog box, click Test Connection.

    If you cannot access the Data Source, check that you have filled out the various tabs with correct file and pathnames.

To edit a data source, select one from the list in the ODBC administrator window and click Configure.

If you need to access Windows across a network in order to create an ODBC data source, see the Sybase IQ Installation and Configuration Guide.