8 Stew is the database (SQL) tool with JDBC.
10 For details, see "README.md".
15 ### Password Management
17 By defaults, passwords are not encrypted.
18 Setting "Encryption" in the connector will encrypt the password.
20 For details, see [How To Use - Configuration Of "Connector"](#configuration-of-connector).
23 ### Rollback Does Not Work When The Connection Is Disconnecting
25 By defaults, Rollback does not work automatically on disconnect.
26 You have to care that some of DBMSs commit on disconnect.
28 Setting "Auto Rollback" in the connector will rollback automatically on disconnect.
30 For details, see [How To Use - Configuration Of "Connector"](#configuration-of-connector).
35 For more information, see the project site.
37 - <http://stew.sourceforge.jp/>
38 - <http://argius.github.io/Stew4/>
43 Just extract the package archive file.
48 If you want to use GUI mode, execute the following command:
50 > java -jar stew.jar --gui
52 If you want to use CUI mode, execute the following command:
54 > java -jar stew.jar --cui
56 At first time, a system directory ".stew" created. It is used by some configurations.
57 By default, ".stew" creates at the current directory.
62 Remove all of installed files and ".stew" directory.
65 ----------------------------------------------------------------------------------------------------
69 To access database with Stew, you need DBMS that supports JDBC and its JDBC driver.
70 For details, see the manual of DBMS.
73 ### Configuration Of "Connector"
75 In Stew, an asset of JDBC Connection called it "Connector".
77 In CUI mode, to start edit tool, specifies --edit option.
85 In GUI mode, executes "Edit Connectors" to start edit dialog.
88 Connector has the following properties:
91 : ID for connector command. Allows only ASCII letters (A-Za-z0-9).
94 : The name to display at Prompt.
97 : Specifies classpath of JDBC driver. This form is same with -CLASSPATH option.
100 : Specifies the driver class that implements java.sql.Driver.
101 (In GUI mode, you can use the "search Driver" button.)
104 : Specifies JDBC URL (same as url at DriverManager.getConnection(url)).
107 : Specifies the user ID.
110 : Specifies the password of its user ID.
113 : Specifies the type to save password into file.
114 See the next section.
117 : Is set to READONLY the connection, so that you can not run the commands that update.
118 (., Which according to ReadOnly the command side)
121 : If it was set, the transaction will be rollbacked automatically when disconnect.
125 ### About Password Management
127 How to save the password, you can select the encryption process.
130 : Saves as plain text. (default)
133 : You can store your password by using the PBE encryption.
136 ### Anonymous Connector
138 ### Non-interactive Mode
141 ### connect - Connects to database (built-in)
143 > connect <connector-id>
146 This command connects to database with prepared Connector.
148 In interactive mode, connection is kept until disconnect.
149 If already connected, disconnect it first, then connect.
152 ### disconnect - Disconnects from database (built-in)
157 This command disconnects from database.
159 If auto-rollback was available, try to rollback before disconnecting.
162 ### commit - Commits current transaction (built-in)
164 This command commits current transaction.
166 ** caution: Commit cannot cancel. Please use carefully. **
169 ### rollback - Rollbacks current transaction (built-in)
171 This command rollbacks a current transaction.
174 ### -e - Evaluates multiple commands (built-in)
176 > -e <command> -e <command> ...
178 For example, you can execute two export command continuously,
179 or can execute as batch in non-interactive mode.
182 ### -f - Executes file content as command (built-in)
189 ### -s - Executes file content as script (built-in) \<improved feature in version 4.1\>
191 > -s . | <SCRIPT FILE> | <SCRIPT-NAME> <SCRIPT-CODE>
193 1. If the first argument is ".", the Script Context is reset.
194 2. If the first argument is a filename with extension, the script language is identified by the extension, and the file is run as the script language's script.
195 3. Otherwise, the first argument is recognized as the name of a script language, and the rest of arguments are executed as the script language's script.
197 (Only the built-in JavaScript by file is supported in version 4.0.)
199 To use script languages except the built-in script language (JavaScript), it requires each script engine of script languages such as jruby, jython and groovy.
201 The Script Context keeps global scope bindings, and following scripts can reuse the bindings.
202 If you want to reset Script Context, input " -s . " above.
205 The following variables will be available in the script (global scope):
207 * the reference of current connection: connection, conn
208 * the reference of Parameter: parameter, p
209 * the reference of OutputProcessor: outputProcessor, op
212 ### cd - Changes current directory (built-in)
216 Changes current directory to specified one.
217 (This current directory is not OS's, but internal Stew.)
220 ### @ - Displays directories (built-in)
224 Displays the paths of current directory and system directory.
227 ### ? - Displays System Properties (built-in)
229 > ? [<property-name> [<property-name-2> ... <property-name-n>]]
231 Display System Properties. (System.getProperty)
233 By defauts, it displays JRE, OS and Locale.
239 > ? java.version user.timezone zzz
240 java.version=[1.6.0_##]
241 user.timezone=[Europe/London]
245 ### alias - Registers alias (built-in)
247 > alias [<name> [<command>]]
249 Registers the alias of command.
250 When called with an argument, display the alias and its command.
251 When called without arguments, display all aliases.
253 Before registering or displaying, refreshes cached info in memory.
254 If modified aliases in another process, includes you directly edit the config file,
257 (implementation details:
258 for the infinite loop suppression of circular references,
259 the depth of the expansion up to 100.)
263 > alias search select * from
264 > alias count select count(*) from
266 alias search=[select * from]
268 >> select * from table1
269 (diplays the results of "select * from table1")
273 ### unalias - Removes alias (built-in)
277 If the specified alias does not exist, does nothing.
278 Whether the target exists or not, refreshes cached info in memory.
281 ### exit - Exits application (built-in)
285 This command exits Stew without confirmation.
287 All connections will be disconnected automatically.
288 Rollback will do only the connector set auto-rollback option.
289 For automatic rollback, see [Usage - Configuration Of "Connector"](#configuration-of-connector).
292 ### load - Executes file content as SQL
294 > load [<SQL-file> | <data-file> <table-name> [ HEADER ]]
296 This command executes the SQL read from specified file.
298 When If a parameter is specified, executes file content as SQL,
299 otherwise, two or more parameters, imports the file as data file.
300 The file format is automatically selected by file extension.
303 * .xml : XML format (definition: src/net/argius/stew/io/stew-table.dtd)
304 * otherwise: TSV format
306 (implementation detail: this is basically same as import command,
307 executes as not batch but executes by record)
310 ### import - Imports from file
312 import <data-file> <table-name> [ HEADER ]
314 This command imports from file as data file.
315 The file format is automatically selected by file extension.
318 * .xml : XML format (definition: src/net/argius/stew/io/stew-table.dtd)
319 * otherwise: TSV format
321 (implementation detail: this is basically same as load command,
322 but uses Statement#addBatch.)
325 ### export - Exports to file
327 This command exports result of command to the specified file.
328 The file format is automatically selected by file extension.
330 * .htm,html : HTML format
332 * .xml : XML format (definition: src/net/argius/stew/io/stew-table.dtd)
336 ### time - Measures time to execute SQL
338 > time [<count>] <SQL>
340 This command executes specified SQL and measures its execution time.
342 If specified count, executes SQL by count continuously
343 and summaries "Total", "Ave(average)", "Max" and "Min".
344 Otherwise, executes once and measure its execution time.
346 > time select * from EMPLOYEE
347 execution time: 0.093 seconds
348 > time 100 select * from EMPLOYEE
356 ### find - Finds table names
358 > find <table-name-pattern> [<table-type-pattern> [<schema-pattern> [<catalog-pattern> [ FULL ]]]]
360 This command displays list of tables allowed to show.
361 The parameter including "pattern" in its name can be specified wildcard (#,?).
364 ### report - Reports database info
366 > report - | <table-name> [ FULL | PK | INDEX ]
368 This command displays the info about current connection and connecting database.
370 If specifies - (hyphen), displays the name and version of database and JDBC driver,
371 user and JDBC address.
373 If only specifies table name, displays the column info about specified table.
375 If specifies table name and option,
376 displays the primary key or index info about specified table.
379 ### download - Downloads a column as file
381 > download <root-dir> SELECT <data-column> [, file-path...] FROM ...
383 This command downloads a column data by rows and saves to file.
386 It is useful for downloading large text data or large objects (BLOB, CLOB) all at once.
388 In order to be able to download multiple files,
389 generates file name using column data.
391 The file name will be generated by concatenate second column and after as string.
392 This supporses to specify primary keys and file extension.
394 > download emp select FULL_NAME, JOB_COUNTRY, '/', EMP_NO, '.txt' from EMPLOYEE
395 The dir[./emp/USA] was created.
396 Downloaded. (size=14bytes, file=./emp/USA/2.txt)
397 Downloaded. (size=12bytes, file=./emp/USA/4.txt)
401 Downloaded. (size=12bytes, file=./emp/USA/24.txt)
402 The dir[./emp/England] was created.
403 Downloaded. (size=11bytes, file=./emp/England/28.txt)
407 Downloaded. (size=18bytes, file=./emp/USA/145.txt)
410 When data exist a record, specified <data-column>,
411 saves file to <root-dir> as file name.
413 Saving file already exists or no permission to write file,
414 the process will abort immediately.
417 ### upload - Uploads file data to a column
419 > upload <file> <SQL(UPDATE|INSERT)>
421 This command registers a data file to the column that specified by place-holder.
424 ### wait - Waits for specified interval
428 This command waits for the interval that specified number (mixed decimal) of seconds.
429 It may be useful for executing multiple commands.
437 Standard commands, "undo", "redo", "cut", "copy", "paste", and "select all", can use in all text components via context menu or shortcut key.
442 A window has "Input/Output Area", "Result Set Table", "Database Info Tree", "Main Menu", "Status Bar" and "Find Pane".
443 By default, the database info tree, the status bar and the find pane" are hidden.
446 ### Input/Output Area ( text area )
448 The I/O area is similar to CUI interface.
450 ... When cursor is at the end of textarea, executes command which is string from prompt to the end of textarea.
451 ... Otherwise, move cursor to the end of textarea.
452 ... The part before prompt can't edit.
455 ... Context menus for this component has the standard commands.
458 ### Paste Paths Into The Text Area Via DnD \<new feature in version 4.2\>
460 When you drag and drop from file manager into the text area, the paths of these files will be pasted to the text area.
461 It also allows plural files.
466 The result set table displays command results, usually query results from database.
468 The row header (the leftmost of the table) displays the row number.
469 ... display "+" sign instead of the row number in the row header.
471 Automatic column width adjustment ...
474 The context menu for this component are listed below:
478 : This command sorts clicked column, not a selected one.
479 The same column is sorted continuously, ... reverse.
482 : This command copies selected cell values as text into the clipboard.
484 Copy With Escape (Ctrl+Shift-C)
485 : This command copies selected cell values as quoted strings into the clipboard.
488 : This command pastes values into selected cells from the clipboard.
489 Type conversion from the text to column types of the cells depends on each JDBC driver implementation.
492 : This command selects all cells in the table.
494 Clear Selected Cell Value
495 : This command clears selected cell values (actually sets NULL).
497 Set Current Time Value
498 : This command sets current time (Timestamp) into selected cells.
501 : This command copies the table header as text into the clipboard.
504 : This command shows the find pane and sets find target ...
507 : This command adds a new empty row into the table.
509 Insert From Clipboard
510 : This command ... imports data from the clipboard and inserts the data into the linking table.
513 : This command adds duplicate rows ... selected cells.
515 Link Rows Into Database
516 : This command make unlink ...
519 : This command deletes selected rows.
520 The deleted rows are also deleted from database.
524 ### Database Info Tree
526 The database info tree is a tree view of hierarchical structure, which consists
527 catalogs, schemas, tables, table type and columns as a tree.
528 Not connected: blank ...
529 just connected: connector as a root node and sub nodes ...
530 Each node expands ...
533 An "Auto-expansion" is a function to automatically expands nodes in the database info tree when connecting a database.
534 If you use it, create a TSV file named "autoexpansion.tsv" in the system directory (.stew) and write node name lists as TSV into this file.
537 The context menu for this component are listed below:
541 : This command copies displayed strings of selected nodes as text into the clipboard.
544 : This command copies the simple name of selected nodes as text into the clipboard.
547 : This command copies the full qualified name of selected nodes as text into the clipboard.
552 Generate WHERE Phrase
553 : This command generates a WHERE phrase consisting selected tables and columns ...
554 selected same name, generate ...
556 Generate SELECT Statement (with WHERE)
557 : This command generates a SELECT statement with "WHERE" keyword.
559 Generate UPDATE Statement (with WHERE)
562 Generate INSERT Statement
565 Jump To Column By Name
566 : This command ... the name of selected node. Jump to the column which has the same name in current result table if found it.
567 Double-clicking the node is the same as this command.
569 Toggle Show Column Number
570 : This command provides the toggle between showing and hiding the column number of all columns nodes.
580 ... Display last command and its execution time.
581 ...This time is not query but command.
584 ### Saving Configuration
592 It is not able to change key bind after opening new window.
593 ... For the keywords, see https://github.com/argius/Stew4/blob/master/src/net/argius/stew/ui/window/Menu.u8p
596 ## Menus in the GUI Mode
598 ### File - New Window (N) Ctrl-N
600 This command opens a new window.
601 Current connections are independent of each window.
604 ### File - Close Window (C) Ctrl-W
606 This command closes current window.
607 If connected, show confirm dialog.
609 If current window is only a window, processes as Quit(Q).
612 ### File - Quit (Q) Ctrl-Q
614 This command quits this application.
615 When executed, shows confirm dialog. Click "Yes" to quit.
618 ### Edit - Cut (T) Ctrl-X
620 This command cuts the selection to the clipboard.
623 ### Edit - Copy (C) Ctrl-C
625 This command copies the selection to the clipboard.
628 ### Edit - Paste (P) Ctrl-V
630 This command pastes the selection to the clipboard.
633 ### Edit - Select All (A) Ctrl-A
635 This command selects all text or all elements.
638 ### Edit - Find (F) Ctrl-F
640 This command finds out a specific string from selected component.
645 ### Edit - Toggle focus (G) Ctrl-G \<improved feature in version 4.2\>
647 This command toggles focus between the database info tree, the the result set table and the input/output area in a current window.
649 ### Edit - Clear Message (M)
651 This command clears input/output area in a current window.
654 ### View - Show Status Bar (S)
656 This command toggles the visibility of status bar in a current window.
659 ### View - Show Column Number (C)
661 This command toggles the visibility of column number in the result set table of a current window.
664 ### View - Show Info Tree (I)
666 This command toggles the visibility of database info tree in a current window.
669 ### View - Always On Top (T)
671 This command toggles the state that always stays on top of a current window.
674 ### View - Refresh (R) F5
679 ### View - Widen Column Width (W) Ctrl-.(period)
681 This command widens all column widths in the result set table of a current window.
684 ### View - Narrow Column Width (N) Ctrl-,(comma)
686 This command narrows all column widths in the result set table of a current window.
689 ### View - Adjust Column Width (A) Ctrl-/(slash)
691 This command adjusts all column widths in the result set table of a current window.
692 For about adjust mode, see the next item.
695 ### View - Auto Adjust Mode (M)
697 This command selects auto-adjusting mode to use when shows result.
699 There are following modes:
701 * None(N): does nothing.
702 * Header(H): adjusts column width based on each header string.
703 * Value(V): adjusts based on the longest string in column values.
704 * Header And Value(A): adjusts based on the longest string in column values and column header string.
707 ### Command - Execute (X) Ctrl-M
709 This command executes command.
710 This is same as pressing enter key in the end of the I/O area. (... same behavior)
713 ### Command - BREAK (B) Ctrl-Pause(Break)
715 This command cancels executing command.
716 The process on the server is not canceled.
719 ### Command - History Back (P) Ctrl-Up
721 This command rotates command histories backward.
724 ### Command - History Next (N) Ctrl-Down
726 This command rotates command histories forward.
729 ### Command - Show All Histories(A) \<new feature in version 4.2\>
731 This command shows all command histories and paste a choosen commmand.
734 ### Command - Rollback (R)
736 This command displays confirm dialog and click "OK" to rollback.
739 ### Command - Commit (M)
741 This command displays confirm dialog and click "OK" to commit.
744 ### Command - Connect (C) Ctrl-E
746 This command shows the list of connectors.
747 Select connector name you want to connect to, and click "OK" to executes connect command.
750 ### Command - Disconnect (D) Ctrl-D
752 This command disconnects current connection.
753 This is the same as disconnect command.
756 ### Command - Post-Proccess (0)
758 This command specifies the configuration of a "Post-Proccess" mode.
760 The "Post-Proccess" is an action to notify that command finished.
761 When the window which command is running, is not active, "Post-Proccess" is invoked.
763 There are following modes:
765 * None(N): Does nothing.
766 * Focus(F): Focuses window.
767 * Shake(S): Shakes window.
768 * Blink(B): Blinks window.
771 ### Command - Encryption Key (K)
773 This command shows the dialog to input an encryption key.
776 ### Command - Edit Connectors (E)
778 This command shows the dialog to edit connectors.
781 ### Data - Sort (S) Alt-S
783 This command sorts records by selected column.
786 ### Data - Import File (I)
788 This command imports from file into the table of current result.
791 ### Data - Export File (E) Ctrl-Shift-S
793 This command exports results into file.
798 This command shows this help file by default browser.
801 ### Help - About Stew
803 This command shows version dialog about Stew.
809 You can set these system properties into java -D option or stew.properties file.
812 ### net.argius.stew.properties - Location Of Properties File
814 Property Value: a file path or a directory path
816 This property specifies the location of "stew.properties" file.
817 This properties file is used as system properties and searched in the following steps:
819 +If it specifies a file path, the file will be used as system properties.
820 +If it specifies a directory path, the file will be searched a "stew.properties" file in the directory.
821 +Search a file in the classpath.
822 +Search a file in the system directory.
824 The first file found is used.
825 If a file is not found, ... (ignore it).
828 ### net.argius.stew.directory - Working Directory
830 Property Value: a directory path (default: current directory)
832 This property specifies the current directory as a internal state at the start, but it is not a platform one.
835 ### net.argius.stew.query.timeout - Query Timeout
837 Property Value: integer seconds (default: 0)
839 This property specifies the query timeout which is used in commands.
841 If it is under 0, the property was not set.
843 (implementation detail: for java.sql.Statement#setQueryTimeout)
846 ### net.argius.stew.rowcount.limit - Limit Of Display Result Row Count
848 Property Value: maximum number of rows (default: Integer.MAX_VALUE, about 2,147,000,000)
850 This property specifies the maximum number of rows which show in the result set table.
851 It is not used to output files, such as the export command.
854 ### net.argius.stew.command.Import.batch.limit - Limit Of Import Command Using Batch
856 Property Value: limit number of rows (default: 10000)
858 This property is used by the Import command.
859 It is not used to output files, such as the export command.
862 ### net.argius.stew.ui.window.resident - Regident
864 Property Value: integer minutes
866 This is an experimental feature.
868 The app redraws continuously at the specified interval to prevent swap-out.
871 ### Logger Configurations
873 Use logging.properties in this package.