Using jisql


This document explains how to use the jisql utility. It contains these sections:

Refer to the jisql online help for more information.

What is jisql?

jisql is an easy-to-use Transact-SQL (T-SQL) editor with a graphical user interface.

jisql helps you to compose T-SQL command statements, execute your T-SQL queries, and view the results either as text or within a table.

jisql can save your input or results data in common file formats that you can then import into other applications (for example, Microsoft Excel or bcp).

jisql is written in Java, uses no platform-specific code, and takes advantage of the Java Foundation Classes (JFC), which are a part of Swing. The Swing components are written in Java, without window-system-specific code, which allows you to use jisql in your favorite environment with the look and feel you are used to without having to rely on the native windowing system.


Starting jisql

Platform Command
UNIX Type jisql at the command line.
Windows

Click Start, then click Run. When the Open dialog box displays, type the path to jisql.bat, then click OK.


Syntax and Parameters

You can also start jisql using the following command line parameters and syntax:

	jisql	[-d] [-v] [-L metal|system] [-U username] [-P password]
		[-Z <language>][-C <LoginInformationFile>] 
[-S host:port[?propname=value[&propname=value]...]

or

		[-S JDBC URL[?propname=value[&propname=value]...] 
or
		[-S JNDI URL[?propname=value[&propname=value]...


Parameter

Description

-d

Switches to debug mode.

-v

Displays the version number.

-L

Sets the look and feel of jisql:

  • "metal" uses the Java Software look and feel.
  • "system" uses the Motif, Windows, or MacIntosh look and feel, depending on your operating system.

The default look and feel of jisql is "metal."

-U

The login ID with which you want to use to connect to the database.

Note:  If you specify -S, you must also specify -U.

-P

The password for the specified login ID.

-Z <language>

Sets the language of the labels in jisql. The currently supported values are U.S. English, Chinese, Deutsch (German), Espanõl (Spanish), Français (French), Japanese, Korean, and Português (Brazil).

-C <LoginInformationFile>

Sets the path and name of the file where the login information is stored. If you specify this value, the connection window will display this information. The property file is named jisql.prp and is created in your current home directory.

-S

Host:Port?Properties

or

JDBC URL

or

JNDI URL

where:

  • Host is the name of the machine on which the database server is running.
  • Port is the port to which the database server is listening.
  • Properties are connection properties as described in the jConnect for JDBC Programmer's Reference.
  • JDBC URL is the complete JDBC URL.
  • JNDI URL is the JDNI connection string and its appropriate properties. See jConnect for JDBC Programmer's Reference for more information.

To specify more than one property, connect them using an ampersand (the "&" character). Do not use blanks, and remember to put the string in quotes when you use "?" and "&."

Note:  If you specify -S, you must also specify -U.

Examples

This section contains examples of invoking jisql using various parameters.

To use the Java Software look and feel and open a connection window, you would enter:

jisql

To set the look and feel to Motif, Windows, or MacIntosh (depending on your operating system) and open a connection window, you would enter:

jisql -L system

To set the look and feel to Motif, Windows, or MacIntosh (depending on your operating system), open a connection to the host "serv," and set the user to sa with a password, you would enter:

jisql -L system -S serv:3312 -U sa -P pass

To use the Java Software look and feel, open a connection to the host "serv," and set the user to sa with no password, you would enter:

jisql -S serv:3312 -U sa

To use the Java Software look and feel, open a connection to the host "serv," set the user to sa with a password, and set the HOSTNAME and PACKETSIZE properties, you would enter:

jisql -L metal -U sa -P pass -S
	serv:3312?HOSTNAME=brillig&PACKETSIZE=4096

To use the Java Software look and feel, set the user to sa with a password, and use the complete JDBC URL to open a connection to the host "serv," you would enter:

jisql -U sa -P pass -S jdbc:sybase:Tds:serv:3312

To use the Java Software look and feel, set the user to sa with a password, and use Sun Microsystems, Inc.'s LDAP factory to provide a JNDI connection, you would enter:

jisql -U sa -P pass -S "jdbc:sybase:jndi:
	ldap://LDAP_hostname:LDAP_port/servername,
	o=MyComany,c=US?INITIAL_CONTEXT_FACTORY=
	com.sun.jndi.ldap.LdatCtxFactory&PROVIDER_URL=
	ldap://LDAP_hostname:LDAP_port"

 

Logging In To jisql

After you start jisql, a login window displays where you enter the following connection parameters:

Username - The login ID.

Password - The password for the Login ID specified.

Hostname - The name of the machine on which the database server is running.

Portnumber - The port to which the database server is listening.

Properties - Optional. Any jConnect connection properties you want to specify. See the jConnect for JDBC Programmer's Reference for a list of connection properties.

Language - The language in which jisql labels display. The currently supported values are U.S. English, Chinese, Deutsch (German), Espanõl (Spanish), Français (French), Japanese, Korean, and Português (Brazil).

Click Connect to make the connection.

After you log in successfully the first time, the connection parameters you specified (except the password), are stored in a property file. The next time you log in, you only need to enter the password. The property file is named jisql.prp and is saved in your home directory. It always contains the data from the last successful connection.

Working with jisql

After you connect to a host server, the jisql connection window displays, which is made up of the several components: the toolbar, the Input Window, the Output Window, and the Status Window. There is also a detachable menu bar.

Toolbar

Click Go to execute the statement(s) that appear in the Input Window.

The database drop-down list box shows all of the databases associated with the server named on the toolbar. To quickly change from one database to another within a connected session, click the database name in the drop-down list box.

Click the History icon to open a History Window, which displays all previous batches (consisting of 1 or several statements) for the current connection. To specify the maximum number of batches to store in the history buffer, use the Miscellaneous tab on the Options Window. Highlight the text you want to reuse and click Go to redisplay the statement or batch in the Input Window and execute it again.

Click the Up icon to select the previous batch in the History Window and display it in the Input Window where you can edit the command or click Go and execute it again.

Click the Down icon to select the next batch in the History Window and display it in the Input Window where you can edit the command or click Go and execute it again.

Input Window

Enter or paste one or more query statements into the Input Window. You may divide statements by the command delimiter (the default is 'go', which you can change using Options | Open Option Window | Input Window Options). The Input Window is the only target for a paste operation executed from the Edit menu.

To change the Input Window defaults, use Options | Open Option Window | Input Window Options.

Output Window

The Output Window displays the results sets being returned by the server in response to a statement's execution. This may be a Swing Table Component (jTable) or a ordinary text area. See Table vs. Text output for more information.

When you have multiple ResultSets (Table output only), each ResultSet displays on a separate "tab" in the Output Window. Click the tab title to display the next ResultSet.

The Output Window clears when the ResultSet arrives from a new statement or batch.

When the output mode is a Table, some datatypes can be handled in a special way when they appear in the ResultSet. Special handling is currently implemented for the image object datatype. Also see image object columns for more information.

To change the Output Window defaults, use Options | Open Option Window | Output Window Options.

Status Window

The Status window displays various messages:

Menu Bar

Each menu and menu command has one letter underlined; this is a mnemonic key that you can use to invoke the menu or menu command when the menu is active. When you invoke a menu or menu command, its action or setting applies to the current session of the currently active connection window.

Although you may have several windows open, only one window can be active at a time. When a window is active, it jumps to the front of other windows and the title bar changes or intensifies in color.

For more information on any of the GUI components, see the jisql online help.

Entering and Executing Queries

A batch file (or script) is a collection of Transact-SQL statements used to perform a task. Scripts, stored as files, form a foundation for many server application projects. Definitions of tables, indexes, and stored procedures, as well as reports and batch jobs, are usually stored in script files.

Once you make a connection to a server, click the Database drop-down list and click the name of the database with which you want to work. You can enter queries in a number of ways. To execute a query, click the Go button on the toolbar, or select Execute Query from the Query menu.

Click the History icon . In the History Window, highlight the statement(s) you want to execute, then click Go on the button bar of the connection window. You can also use Ctrl+c to copy statements from the History Window, then use Ctrl+v to paste the statement(s) to the Input Window.

The ResultSets display in the Output Window.

Known Problems

"Font specified in font.properties not found [-monotype-arial-bold-r-normal--*-% d-*-*-p-*-iso8859-1]"

For Linux:, check www.gimp.org/fonts.html and follow the instructions about how to add fonts.
For Solaris: there is a new /jre/lib/font.properties file available. See http://cheat.xcf.berkeley.edu/archive/java2d-interest/9807/0107.html


Copyright 1999 © Sybase, Inc. All Rights Reserved.