SQLMinus - a far friendlier SQL client
"The SQL Client that sucks far less."-me, circa 1997
What is SQLMinus ?
SQLMinus is an SQL Client with many developer-friendly features including::
- auto-linking across tables
- dependency discovery
- simple, intuitive and powerful keys to sort columns and filter data
- tab-completion of table and column names
- expansion of abbreviations (as in vi)
- expansion of previously entered words (as in vim)
- User may select tables and columns from combo lists and
construct an SQL. Does auto-joining of fields, thus making SQL construction very easy
- preferences may be configured by user in file, or specified during session
- creation of create, insert, update script from table metadata
- creation of create index scripts by just selecting table and keys
- creation of other scripts (e.g. primary key) by just selecting table and columns
- allow user to add new script templates that will generate scripts on selecting tables and columns
- data presented in text format or tabular format (JTable). Multiple tables may be viewed
- Allows reflection of java.sql classes and the database meta
- User may save command or output area to file and read the same from
- User can run a batch command from a file. If the driver does not
support batched SQLs, then they would be issued individually
- User may define an SQL statement to be executed for multiple tables
(such as if a user wants to see the count of rows in many tables one
by one, or all data in a table one by one)
- Can auto-construct a query based on table/s and field/s selected in combo.
Will automatically create joins on identically named fields.
- One may specify links between tables in the ini file. When
auto-constructing an SQL, descriptive fields such as person_name or
dept_name will also be picked from the master table. See the ini
file for an example of a link.
# specify automatic sort on a table
# specify automatic join on a table
# link projectcode of PROJECTRESOURCES with the same field of
# PROJECT and show PROJECTNAME
# link EMPID with EMPID and print EMPNAME
- preferences can be specific to database or product or user (using
hooks as in mutt)
- SQLs can be set as bookmarks which will appear in Bookmarks menu,
or can be loaded from a file in XML format.
- regular expression searching in results
- paging of results
- intelligent linking across tables
- define your own keystrokes for actions
- Has been used on both Oracle and mysql
- Updating/deleting data in table view: the data tables are readonly,
however, if you select a row, and press Table - Update Action, the sql
to update that row will be appended into the input area. Similarly, you
can press Delete Action etc. Then you modify the sql and run it.
Who is SQLMinus meant for?
It probably is more programmer friendly, than end-user friendly, although this is less so than earlier.
This tool is meant for fast querying of tables, repetitive querying, quick sorting and linking across tables.
It sacrifices features not used often, for ease of frequently used features. It almost completely eliminates having to type mundane SQL statements to join tables or filter data !
It is inspired by vim, mutt and other "intelligent"Unix softwares.
What are the prerequisites?
You need the following:
- java 1.4
- Jakarta-oro package in classpath (go to jakarta-apache.org).
- XML Parser such as jaxp.jar and crimson.jar in classpath, used
for the bookmarks file. (Not required if you use 1.4)
- a jdbc driver for a database (jdbc 2.0 preferable)
Download SQLMinus from here
How do I install ?
- add jakarta-ORO and the jdbc driver to your classpath
- add jaxp.jar and crimson.jar in your classpath (required for java 1.3 or lower).
- Make a copy of the mysql.ini file
- Edit the mysql.ini file and replace DRIVER with the name of
your jdbc driver (it will usually start with "org.")
Also modify the user id and password
Modify the DSN, which helps this program connect to the database
server. The driver documentation should help you with this. You will
need to know the IP address and port of the database.
This is the minimal configuration for the tool. You may study the other
options and configure them later at your own speed.
How to I run the tool?
I give the command "./runnit.sh" or "java isql/SQLForm &" on the
linux prompt in the folder
where the class file are.
When the tool loads (5-7 seconds on a P2 350 with 1.4.2), i press the connect button (unless i have configured ocnnect in the ini). This
loads the tables from the database in the list on the right top.
Clicking on a table, will populate the columns list on right bottom.
I often select a table and press the data button (or alt-D). This
displays the data in a table.
When i select a column, it gets inserted into the input area. I can thus
construct an SQL statement. I could also press the Construct button -
it will make the SQL for me. I then select the SQL with the mouse
and press "Run Selected". Or if there is only one statement
i can press "Run".
I can go to the History area and select a previously executed statement
and run it.
I frequently press "?" on a code field - immediately the related master table row is displayed. Else i am prompted to create a link.
I then keep jumping across tables without ever having to write a query.
I frequently press "o" or "O" after selecting one or more fields to sort or reverse sort on those fields.
I frequently press "y" after selecting one or more fields to save their values in memory. I can then select a table and press "alt-shift-d" to view matching rows for the saved values.
SQLMinus is really useful when it comes auto-construction. Once i set my links, it picks up descriptive fields from related tables and displays them automatically.
What does the name SQLMinus mean?
"SQLplus, minus the pain". I have used sqlplus for many years - it
doesnt provide completion of names, editing of command line etc. I
found it very frustrating. The only advantage was that you could run
sqlplus on telnet.
What about Stability/ Bugs?
Error handling is minimal, but should not affect you at all.
- In some rare instances tab-completion eats up the previous word also.
- When there is an error in command/sql, it says "Nothing selected".
- There are bugs in the metadata information returned by Oracle's
drivers, thus i have put hacks in place. (in one instance the
java.sql.Types field, doesnt correspond to the typename).
- mysql and Oracle often require different parameters while fetching
metadata. You may need to change them if you have a problem on another
database, or even on your instance. (fetching
- I haven't figured out a way of informing user that a CREATE/DROP/ALTER
or other statement has succeeded.
What about speed/efficiency?
Since this is written entirely in Java, it may be slow if
used with very large tables. Usually its best when jumping back and
forth between a large number of linked tables, while troubleshooting an
application error, or answering a query.
What does it not provide?
This list has reduced dramatically.
Database specific features like running stored procedures are one feature.
- running queries in the background
- calling stored procedures.
How does it stack up to other clients?
- sqlplus - it lacks some functionality of sqlplus, but is far easier to
use. sqlminus can connect to all database that have a jdbc driver.
- toad - toad is far better in many ways, but isn't free. It may
still only run on Windows. Again, sqlminus does many things better.
- tora - tora has a lot more functionality, but sqlminus does the
things i do, better than tora
- fredy's admin - cant remember, just tried it once or so.
- henplus- great for telnet session. CUI. Handles multiple sessions
at one time using sub-shells. sqlminus is far friendlier.
Anyone using SQLMinus?
There have been many downloads from sourceforge. Once in a while i get a
mail of appreciation (much welcome), so there are many users.
How can I help?
- Use the tool
- Report bugs to me at rahulkumar at users dot sourceforge dot net )
- Give feedback on features required
- Give suggestions for improving the UI
- Be a vegetarian. Stop killing living beings.
More details on features - see features
How does it look ?
On clicking Meta button
Selected Employee Table
Then click Data button
Select Frame View, select a table, then click Data button
Select Employee and Dept and click Construct
Select department and then List, View Columns
Select department and then List, View Indexes
Autolink example - on Timesheet table, select EMPID fields and press ?. View related Employee Data. Jump to other related tables from there.
AutoConstruct example - Select fields from only TimesheetItems, 3 others tables are linked, and descriptions of selected codes displayed.
Note: This software works fine, but is more or less abandoned. IF yu wish you may take over the source and continue.
See Raining Sockets for a high-performance NIO framework
High Performance IO in Java