Stew is the database (SQL) tool with JDBC.
For details, see "README.md".
By defaults, passwords are not encrypted. Setting "Encryption" in the connector will encrypt the password.
For details, see How To Use - Configuration Of "Connector".
By defaults, Rollback does not work automatically on disconnect. You have to care that some of DBMSs commit on disconnect.
Setting "Auto Rollback" in the connector will rollback automatically on disconnect.
For details, see How To Use - Configuration Of "Connector".
For more information, see the project site.
Just extract the package archive file.
If you want to use GUI mode, execute the following command:
> java -jar stew.jar --gui
If you want to use CUI mode, execute the following command:
> java -jar stew.jar --cui
At first time, a system directory ".stew" created. It is used by some configurations. By default, ".stew" creates at the current directory.
Remove all of installed files and ".stew" directory.
To access database with Stew, you need DBMS that supports JDBC and its JDBC driver. For details, see the manual of DBMS.
In Stew, an asset of JDBC Connection called it "Connector".
In CUI mode, to start edit tool, specifies --edit option.
# command line
$ stew --edit
# running stew
> --edit
In GUI mode, executes "Edit Connectors" to start edit dialog.
Connector has the following properties:
ID for connector command. Allows only ASCII letters (A-Za-z0-9).
The name to display at Prompt.
Specifies classpath of JDBC driver. This form is same with -CLASSPATH option.
Specifies the driver class that implements java.sql.Driver. (In GUI mode, you can use the "search Driver" button.)
Specifies JDBC URL (same as url at DriverManager.getConnection(url)).
Specifies the user ID.
Specifies the password of its user ID.
Specifies the type to save password into file. See the next section.
(., Which according to ReadOnly the command side)
How to save the password, you can select the encryption process.
Saves as plain text. (default)
You can store your password by using the PBE encryption.
> connect <connector-id>
> -c <connector-id>
This command connects to database with prepared Connector.
In interactive mode, connection is kept until disconnect. If already connected, disconnect it first, then connect.
> disconnect
> -d
This command disconnects from database.
If auto-rollback was available, try to rollback before disconnecting.
This command commits current transaction.
** caution: Commit cannot cancel. Please use carefully. **
This command rollbacks a current transaction.
> -e <command> -e <command> ...
For example, you can execute two export command continuously, or can execute as batch in non-interactive mode.
> -f <file>
...
> -s . | <SCRIPT FILE> | <SCRIPT-NAME> <SCRIPT-CODE>
(Only the built-in JavaScript by file is supported in version 4.0.)
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.
The Script Context keeps global scope bindings, and following scripts can reuse the bindings. If you want to reset Script Context, input " -s . " above.
The following variables will be available in the script (global scope):
> cd <directory>
Changes current directory to specified one. (This current directory is not OS's, but internal Stew.)
> @
Displays the paths of current directory and system directory.
> ? [<property-name> [<property-name-2> ... <property-name-n>]]
Display System Properties. (System.getProperty)
By defauts, it displays JRE, OS and Locale.
> ?
JRE : ...
OS : ...
Locale : en_UK
> ? java.version user.timezone zzz
java.version=[1.6.0_##]
user.timezone=[Europe/London]
zzz=undefined
> alias [<name> [<command>]]
Registers the alias of command. When called with an argument, display the alias and its command. When called without arguments, display all aliases.
Before registering or displaying, refreshes cached info in memory. If modified aliases in another process, includes you directly edit the config file, run this command.
(implementation details: for the infinite loop suppression of circular references, the depth of the expansion up to 100.)
> alias
No aliases.
> alias search select * from
> alias count select count(*) from
> alias search
alias search=[select * from]
> search table1
>> select * from table1
(diplays the results of "select * from table1")
>
> unalias <alias>
If the specified alias does not exist, does nothing. Whether the target exists or not, refreshes cached info in memory.
> exit
This command exits Stew without confirmation.
All connections will be disconnected automatically. Rollback will do only the connector set auto-rollback option. For automatic rollback, see Usage - Configuration Of "Connector".
> load [<SQL-file> | <data-file> <table-name> [ HEADER ]]
This command executes the SQL read from specified file.
When If a parameter is specified, executes file content as SQL, otherwise, two or more parameters, imports the file as data file. The file format is automatically selected by file extension.
(implementation detail: this is basically same as import command, executes as not batch but executes by record)
import <data-file> <table-name> [ HEADER ]
This command imports from file as data file. The file format is automatically selected by file extension.
(implementation detail: this is basically same as load command, but uses Statement#addBatch.)
This command exports result of command to the specified file. The file format is automatically selected by file extension.
> time [<count>] <SQL>
This command executes specified SQL and measures its execution time.
If specified count, executes SQL by count continuously and summaries "Total", "Ave(average)", "Max" and "Min". Otherwise, executes once and measure its execution time.
> time select * from EMPLOYEE
execution time: 0.093 seconds
> time 100 select * from EMPLOYEE
Total: 0.484 seconds
Ave: 0.005 seconds
Max: 0.094 seconds
Min: 0.000 seconds
>
> find <table-name-pattern> [<table-type-pattern> [<schema-pattern> [<catalog-pattern> [ FULL ]]]]
This command displays list of tables allowed to show. The parameter including "pattern" in its name can be specified wildcard (#,?).
> report - | <table-name> [ FULL | PK | INDEX ]
This command displays the info about current connection and connecting database.
If specifies - (hyphen), displays the name and version of database and JDBC driver, user and JDBC address.
If only specifies table name, displays the column info about specified table.
If specifies table name and option, displays the primary key or index info about specified table.
> download <root-dir> SELECT <data-column> [, file-path...] FROM ...
This command downloads a column data by rows and saves to file.
For any data type. It is useful for downloading large text data or large objects (BLOB, CLOB) all at once.
In order to be able to download multiple files, generates file name using column data.
The file name will be generated by concatenate second column and after as string. This supporses to specify primary keys and file extension.
> download emp select FULL_NAME, JOB_COUNTRY, '/', EMP_NO, '.txt' from EMPLOYEE
The dir[./emp/USA] was created.
Downloaded. (size=14bytes, file=./emp/USA/2.txt)
Downloaded. (size=12bytes, file=./emp/USA/4.txt)
.
.
.
Downloaded. (size=12bytes, file=./emp/USA/24.txt)
The dir[./emp/England] was created.
Downloaded. (size=11bytes, file=./emp/England/28.txt)
.
.
.
Downloaded. (size=18bytes, file=./emp/USA/145.txt)
Selected 42 records.
When data exist a record, specified <data-column>, saves file to <root-dir> as file name.
Saving file already exists or no permission to write file, the process will abort immediately.
> upload <file> <SQL(UPDATE|INSERT)>
This command registers a data file to the column that specified by place-holder.
> wait seconds
This command waits for the interval that specified number (mixed decimal) of seconds. It may be useful for executing multiple commands.
Standard commands, "undo", "redo", "cut", "copy", "paste", and "select all", can use in all text components via context menu or shortcut key.
A window has "Input/Output Area", "Result Set Table", "Database Info Tree", "Main Menu", "Status Bar" and "Find Pane". By default, the database info tree, the status bar and the find pane" are hidden.
The I/O area is similar to CUI interface.
... When cursor is at the end of textarea, executes command which is string from prompt to the end of textarea. ... Otherwise, move cursor to the end of textarea. ... The part before prompt can't edit.
... Context menus for this component has the standard commands.
When you drag and drop from file manager into the text area, the paths of these files will be pasted to the text area. It also allows plural files.
The result set table displays command results, usually query results from database.
The row header (the leftmost of the table) displays the row number. ... display "+" sign instead of the row number in the row header.
Automatic column width adjustment ...
The context menu for this component are listed below:
This command sorts clicked column, not a selected one. The same column is sorted continuously, ... reverse.
This command copies selected cell values as text into the clipboard.
This command copies selected cell values as quoted strings into the clipboard.
This command pastes values into selected cells from the clipboard. Type conversion from the text to column types of the cells depends on each JDBC driver implementation.
This command selects all cells in the table.
This command clears selected cell values (actually sets NULL).
This command sets current time (Timestamp) into selected cells.
This command copies the table header as text into the clipboard.
This command shows the find pane and sets find target ...
This command adds a new empty row into the table.
This command ... imports data from the clipboard and inserts the data into the linking table.
This command adds duplicate rows ... selected cells.
This command make unlink ...
This command deletes selected rows. The deleted rows are also deleted from database.
The database info tree is a tree view of hierarchical structure, which consists catalogs, schemas, tables, table type and columns as a tree. Not connected: blank ... just connected: connector as a root node and sub nodes ... Each node expands ...
An "Auto-expansion" is a function to automatically expands nodes in the database info tree when connecting a database. 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.
The context menu for this component are listed below:
This command copies displayed strings of selected nodes as text into the clipboard.
This command copies the simple name of selected nodes as text into the clipboard.
This command copies the full qualified name of selected nodes as text into the clipboard.
This command ...
This command generates a WHERE phrase consisting selected tables and columns ... selected same name, generate ...
This command generates a SELECT statement with "WHERE" keyword.
This command ...
This command ...
This command ... the name of selected node. Jump to the column which has the same name in current result table if found it. Double-clicking the node is the same as this command.
This command provides the toggle between showing and hiding the column number of all columns nodes.
See Menus ...
... Display last command and its execution time. ...This time is not query but command.
...
... It is not able to change key bind after opening new window. ... For the keywords, see https://github.com/argius/Stew4/blob/master/src/net/argius/stew/ui/window/Menu.u8p
This command opens a new window. Current connections are independent of each window.
This command closes current window. If connected, show confirm dialog.
If current window is only a window, processes as Quit(Q).
This command quits this application. When executed, shows confirm dialog. Click "Yes" to quit.
This command cuts the selection to the clipboard.
This command copies the selection to the clipboard.
This command pastes the selection to the clipboard.
This command selects all text or all elements.
This command finds out a specific string from selected component.
...
This command toggles focus between the database info tree, the the result set table and the input/output area in a current window.
This command clears input/output area in a current window.
This command toggles the visibility of status bar in a current window.
This command toggles the visibility of column number in the result set table of a current window.
This command toggles the visibility of database info tree in a current window.
This command toggles the state that always stays on top of a current window.
This command ...
This command widens all column widths in the result set table of a current window.
This command narrows all column widths in the result set table of a current window.
This command adjusts all column widths in the result set table of a current window. For about adjust mode, see the next item.
This command selects auto-adjusting mode to use when shows result.
There are following modes:
This command executes command. This is same as pressing enter key in the end of the I/O area. (... same behavior)
This command cancels executing command. The process on the server is not canceled.
This command rotates command histories backward.
This command rotates command histories forward.
This command shows all command histories and paste a choosen commmand.
This command displays confirm dialog and click "OK" to rollback.
This command displays confirm dialog and click "OK" to commit.
This command shows the list of connectors. Select connector name you want to connect to, and click "OK" to executes connect command.
This command disconnects current connection. This is the same as disconnect command.
This command specifies the configuration of a "Post-Proccess" mode.
The "Post-Proccess" is an action to notify that command finished. When the window which command is running, is not active, "Post-Proccess" is invoked.
There are following modes:
This command shows the dialog to input an encryption key.
This command shows the dialog to edit connectors.
This command sorts records by selected column.
This command imports from file into the table of current result.
This command exports results into file.
This command shows this help file by default browser.
This command shows version dialog about Stew.
You can set these system properties into java -D option or stew.properties file.
Property Value: a file path or a directory path
This property specifies the location of "stew.properties" file. This properties file is used as system properties and searched in the following steps:
+If it specifies a file path, the file will be used as system properties. +If it specifies a directory path, the file will be searched a "stew.properties" file in the directory. +Search a file in the classpath. +Search a file in the system directory.
The first file found is used. If a file is not found, ... (ignore it).
Property Value: a directory path (default: current directory)
This property specifies the current directory as a internal state at the start, but it is not a platform one.
Property Value: integer seconds (default: 0)
This property specifies the query timeout which is used in commands.
If it is under 0, the property was not set.
(implementation detail: for java.sql.Statement#setQueryTimeout)
Property Value: maximum number of rows (default: Integer.MAX_VALUE, about 2,147,000,000)
This property specifies the maximum number of rows which show in the result set table. It is not used to output files, such as the export command.
Property Value: limit number of rows (default: 10000)
This property is used by the Import command. It is not used to output files, such as the export command.
Property Value: integer minutes
This is an experimental feature.
The app redraws continuously at the specified interval to prevent swap-out.
Use logging.properties in this package.