Download presentation
Presentation is loading. Please wait.
Published byElisabeth Owens Modified over 9 years ago
1
SQLCMD – A Better DBACCESS? Utility by Jonathan Leffler Presented by Joe Kennedy (joekenn@us.ibm.com) (301-803-1974)
2
Sqlcmd as a SQL Command Interpreter ● DDL ● DML ● Select, Execute Procedure
3
What is it? SQLCMD is an SQL Command Interpreter for Informix databases. It is analogous to the Query-Language option of DB-Access or ISQL, but it is designed to work better in shell scripts. SQLCMD is written in ESQL/C. It works with any version of ESQL/C from 5.00 (circa 1990) upwards. SQLCMD has a history mechanism that allows you to review, edit and rerun commands you ran previously.
4
Alternative Output Formats ● Quote ● CSV ● XML ● Fixed ● Unload (default) -F from the command line!
5
Load & Unload Statements ● Same Syntax as in DBACCESS or ISQL ● No transaction management in load (add your own begin work/commit statements)
6
Reload Statement ● Syntactically similar to load statement automatically initiates transactions, groups the inserts, groups the inserts into smaller transactions if there are many rows to be loaded
7
Info system INFO DATABASES; stores_demo@ids_joe sysmaster@ids_joe sysuser@ids_joe sysutils@ids_joe INFO CONNECTIONS;... INFO TABLES;...
8
SQLunload ● Extract data from the database and produces ASCII output suitable for dbload or LOAD command. ● The database (-d) and table (-t) are always specified on the command line.
9
Sqlreload ● The inverse of Sqlunload ● “Passing resemblance” to the Informix dbload utlity. ● Database (-d) and Table (-t) are always designated at the command line using flags.
10
I/O Redirection Unix/Linux redirection applies echo “select * from customer” | sqlcmd -d stores_demo -F XML
11
Contexts ● Level: 1Input: /dev/stdin ● Output: /dev/stdoutError: /dev/stderr ● Date: mm/dd/yyyyDelimiter: '|' ● Escape: '\\'Quote: '\"' ● EOR: '\n'History size: 50 ● Query limit: 0Transaction size: 1024 ● Input Base: 0BlobDir: /tmp ● XML Record Tag: RECORDFormat: select ● Heading: off History: off ● Continue: off Silence: off ● Trace: off Types: off ● Verbosity: off Benchmark: off
12
Command line options Try “sqlcmd -help” Basic flags: -d database -f FILE -e 'SQL Statements'
13
How do I get the Source Code? The International Informix User Group! www.iiug.org – check the software repository... distributed as a gzipped tar file with the extension ".tgz"
14
Compilation.... SQLCMD is written in ESQL/C, you must have ESQL/C or ClientSDK on your machine before installing SQLCMD. On Unix systems (including Linux), the normal sequence of events is:./configure LD_LIBRARY_PATH make make install
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.