Running interactive SQL queries

Interactive SQL is a utility shipped with Sybase IQ that lets you execute SQL statements, build scripts, and display database data.

When you start Interactive SQL, a Connect window appears that lets you define connection parameters to your server or database. The Connect window also has a Connect Assistant to help you connect to a database. To display or hide the Connect Assistant, click the arrow in the top right corner of the window.

StepsStarting Interactive SQL and running queries

Assume that you want to execute a query against iqdemo that is running on a local host machine named localhost-xp. If you need connection help when you work with Interactive SQL, click the

  1. Click Start, point to Programs | Sybase | Sybase IQ 15.0 | Interactive SQL Java.

  2. On the Identification tab, type DBA in the User box, and sql in the Password box. DBA is not case-sensitive; sql is case-sensitive, and must appear in all lowercase letters.

  3. On the Database tab, choose a server from the Server name box. If there are no servers listed, click Find to search for running servers.

    Server names appear in this format <hostname>_dbname. If the host name is localhost-xp and you are running the sample iqdemo database, the server name would be localhost-xp_iqdemo

  4. Choose iqdemo as the database from the Database name box. If there is only one database running, this can be left blank.

  5. What you do next depends on the server location:

    • If you are running dbisql against a server installed on the same machine, you must also choose an appropriate Database file.

    • If you are running dbisql against a networked server, click the Network tab, click the TCP/IP box, then specify the Host name and Port number.

  6. Click OK to open Interactive SQL.

    The Interactive SQL window is split into 3 subwindows. In the top window (SQL Statements), type:

    SELECT * FROM employees
    
  7. Click the right-facing triangle button to execute the query.

NoteNotes

Creating databases

To create your own databases, start and connect to the utility database, as described in the System Administration Guide.

Starting your own databases

To start your own databases, use the start_iq utility.

To run start_iq, at the Command Prompt, change to a directory where the configuration and database files are located, and use the following command format:

start_iq @configuration_filename.cfg dbname.db

This command starts the database and sets parameters named in the (optional) configuration (.cfg) file.

You can use a configuration file to specify options that you want to set whenever you start your server. A configuration file for the sample database is installed in the %ALLUSERSPROFILE%\SybaseIQ\demo directory as an example. For details about configuration files, see “Using configuration files”.

NoteThe directory where the server is started becomes the default directory for all server files created by Sybase IQ.

For example, to start the demo database, use these commands:

C:\> cd %ALLUSERSPROFILE%\SybaseIQ\demo
start_iq @iqdemo.cfg iqdemo.db

Using defaults in %IQDIR15%\scripts\default.cfg, the start_iq utility sets any required environment variables that have not been set and sets parameters that govern Sybase IQ to the recommended defaults. (You may use a configuration file to override these defaults.) If you start your server using any command other than start_iq, or if your configuration file is encrypted, the following parameters are highly recommended:

Table 4-1: Parameters set by start_iq

Parameter

Value

Description

-c

48MB on all platforms

Catalog store cache size

-gc

20

Checkpoint interval

-gd

all

Allows all users to start the database by connecting

-gl

all

Allows all users to load or unload tables

-gm

10

Default number of connections

-gp

4096

Catalog store page size

-ti

4400

Client time-out set to 72 hours. Prevents users with long queries from being logged off over a long weekend.

NoteDo not discard this document after installing Sybase IQ. You may need these required parameters later.

For a complete list and description of start-up parameters, see “The database server” in Chapter 1 of the Utility Guide.

If you have Sybase Central, you can use the Start Database Server wizard, as documented in the Introduction to Sybase IQ, instead of start_iq.

The server process runs in the background. It sends output to a server log file, %ALLUSERSPROFILE%\SybaseIQ\logfiles\servername.NNNN.srvlog, where NNN is the number of times the server has been started. For example, %ALLUSERSPROFILE%\SybaseIQ\logfiles\localhost_iqdemo.0006.srvlog.

Stopping servers

To stop a server, click the Sybase IQ icon to open the server window, then click Shutdown. You can also stop a server using the STOP ENGINE command from DBISQL or any front-end client, or using the Stop utility, as documented in the Reference Manual, Chapter 4, “Database Administration Utilities.”

NoteWhen you stop a server using the DBSTOP command, you need to specify the same parameters used to start that server.