About Using ttIsql in Interactive or Batch Mode
You can use the ttIsql
utility in two different ways:
interactive mode or batch mode.
When you use ttIsql
in the interactive mode, you can type
commands directly into ttIsql
from the console. When you use
ttIsql
in the batch mode, you can run a prepared script of
ttIsql
commands by specifying the name of the file.
- Experimenting with TimesTen features, testing design alternatives, and improving query performance.
- Solving database problems by examining database statistics.
- Performing periodic maintenance operations including the updating of table statistics, compacting the database, and purging log files.
- Initializing a database by creating tables, indexes, and cache groups and then populating the tables with data.
- Generating simple reports by running common queries.
ttIsql
from the shell,
ttIsql
is in the default interactive mode. The
ttIsql
utility prompts you to type in a valid
ttIsql
built-in command or SQL statement at the
Command>
prompt. The following example starts
ttIsql
in the interactive mode and then connects to a TimesTen
database by running the connect
command using
database1
DSN or without using DSN. There are two ways to connect
to the database as shown in the
example:$ ttIsql
Command> connect database1;
Connection successful:
DSN=database1;DataStore=/disk1/databases/database1;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;PermSize=128;(Default setting AutoCommit=1)
Command>connect “DSN=database1”;
Connection successful:
DSN=database1;DataStore=/disk1/databases/database1;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;PermSize=128;(Default setting AutoCommit=1)
ttIsql
, you can also
specify the DSN
or connection string on the ttIsql
command line. The connect
command is implicitly
run.$ ttIsql -connstr "DSN=database1"
connect "DSN=database1";
Connection successful:
DSN=database1;DataStore=/disk1/databases/database1;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;PermSize=128;(Default setting AutoCommit=1)
Command>quit;
You can access the batch mode in two different ways. The most common way is
to specify the -f
option on the ttIsql
command line
followed by the name of file to run.
CREATE TABLE
statement looks like the
following:$ ttIsql -f create.sql -connstr "DSN=database1"
connect "DSN=database1";
Connection successful:
DSN=database1;DataStore=/disk1/databases/database1;DatabaseCharacterSet=AL32UTF8;
ConnectionCharacterSet=AL32UTF8;PermSize=128;
(Default setting AutoCommit=1)
run "create.sql"
CREATE TABLE LOOKUP (KEY NUMBER NOT NULL PRIMARY KEY, VALUE CHAR (64))
exit;
Disconnecting...
Done.
run
command directly from the interactive command prompt. The run
command
is followed by the name of the file containing ttIsql
built-in commands
and SQL statements to
run:Command> run "create.sql";
CREATE TABLE LOOKUP (KEY NUMBER NOT NULL PRIMARY KEY, VALUE CHAR (64));
Command>
In this example, the create.sql
file is placed in the current directory
of the OS shell from where the interactive ttIsql
utillity is started.
Both relative and absolute paths are allowed for the run
command.