Connecting using command line utilities

The following procedure shows how to connect to a running database from the command line on a UNIX system.

StepsConnecting from a UNIX system

  1. Make sure that your PATH and other environment variables are correctly set, as described in Chapter 1, “File Locations and Installation Settings” in the Sybase IQ Reference Manual.

  2. To ensure that the sample database is loaded on a running server, at the UNIX prompt enter:

    ps -eaf | grep asiqdemo
    

    If you need to start the sample database, enter:

    cd $ASDIR/demo
    
    start_asiq @asiqdemo.cfg asiqdemo.db
    
  3. Start DBISQL by entering the following command:

    dbisql -c "uid=DBA;pwd=SQL;eng=servername;links=tcpip"
    

    Make sure you replace servername with the same server name that was supplied in the start_asiq command to start the server.

    NoteIf you prefer the older utility Interactive SQL Classic to the Java-based version, enter dbisqlc instead of dbisql. Note that although dbisqlc is supported, dbisqlc does not contain all the features of dbisql.

    The –c parameter specifies connection parameters. You can also specify these parameters in a data source, as described later in this chapter.

    NoteThe links=tcpip (or CommLinks=tcpip) parameter is only required if you use TCP/IP to connect to the database. If you use the shared memory port to connect to a local database you can omit the links parameter; however, it is always safer—and required on some platforms—to include complete network parameters.

    To connect to a database on a foreign host, you must add the host name and port number. For example:

    dbisql -c "uid=DBA;pwd=SQL;eng=SERV1_asiqdemo;
    links=tcpip(host=SERV2;port=1234)"
    

    If you prefer, use this alternate form of the links clause, which has the same result:

    "links=tcpip(host=SERV2:1234)"
    

StepsConnecting from a Windows system

  1. Choose Sybase > Adaptive Server IQ 12 > Interactive SQL Java from the Programs menu, or at the Windows command prompt enter

    dbisql
    

    NoteIf you prefer the C version of Interactive SQL, choose Sybase > Adaptive Server IQ 12 > Interactive SQL Classic from the Programs menu, or at the Windows command prompt enter

    dbisqlc
    

    You can include the -c parameter to specify connection parameters in the dbisql command, as described in the procedure above for connecting to UNIX. If you omit these parameters, the DBISQL connect dialog appears.

  2. In the CONNECT dialog, enter your user name and password.

    For example, for the asiqdemo database you enter DBA and SQL, the default user and password combination for Sybase IQ databases when they are created.

  3. Click the Database tab and type the server name that was used to start the server (for example, “hostname_asiqdemo” for the asiqdemo database). This name must be unique on your local area network.

    For remote servers, specify the server as host name:port number.

    The default port number is 2638, but if the host was started with a different number, use that instead. You can find the port number by running Sybase > ODBC Administrator. Select the Data Source on the User DSN tab, then click Configure. The port number is listed on the Network tab. You can also find the port number by typing dblocate at the command prompt.

    This procedure connects you to the first database started on this server. If more than one database is running, you may need to click Browse to select the database you want.

  4. Click OK to connect to the database.

    If the CONNECT dialog or an error message about missing information pops up, you may need to enter the -host and -port or other missing information in the Advanced tab. If your database is on a remote server, enter the -host and -port parameters on separate lines, as in:

    -host fiona
    -port 1870
    
  5. After you connect to the database, the DBISQL window appears. The DBISQL window displays the database name, user ID, and server name for the connection on its title bar.

    If you connect using DBISQLC, the words “Connected to database” appear in the Statistics window along with a message displaying the collation used by the database.