1 / 14

SQLCMD – A Better DBACCESS?

SQLCMD – A Better DBACCESS?. Utility by Jonathan Leffler Presented by Joe Kennedy (joekenn@us.ibm.com) (301-803-1974). Sqlcmd as a SQL Command Interpreter. DDL DML Select, Execute Procedure. What is it?.

gefen
Download Presentation

SQLCMD – A Better DBACCESS?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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: 1 Input: /dev/stdin • Output: /dev/stdout Error: /dev/stderr • Date: mm/dd/yyyy Delimiter: '|' • Escape: '\\' Quote: '\"' • EOR: '\n' History size: 50 • Query limit: 0 Transaction size: 1024 • Input Base: 0 BlobDir: /tmp • XML Record Tag: RECORD Format: <TOS> select <BOS> • Heading: <TOS> off <BOS> History: <TOS> off <BOS> • Continue: <TOS> off <BOS> Silence: <TOS> off <BOS> • Trace: <TOS> off <BOS> Types: <TOS> off <BOS> • Verbosity: <TOS> off <BOS> Benchmark: <TOS> off <BOS>

  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

More Related