Download
Screen Shot
Email

Help support
open source at


ShellRaptor


Command Line SQL Editor/Utility
Present Release: [Stable 1.120705 [stampied]]


Update to 1.120705 [Stampied]
(12/07/05)

Development update!!

NEWS.....
ShellRaptor: A command-line SQL Utility; Supports any JDBC compliant database.
Release 12.07.05 http://shellraptor.sourceforge.net

One new change in this release: now includes the ability to load both .jar and .zip
library extensions.

There is a new feature included in this release that allows for the loading, creation, 
execution and saving of PreparedStatements.

These work with by using the following commands (also available with help;)
load-ps load-ps <file> Load an XML Prepared Statement File
init-ps  init-ps <name> <prepared statement> Create the prepared statement
load-ps  list-ps list the alias names of all available prepared statements that are available
exec-ps  exec-ps <alias> <args1>, <args2>, <args...n> Execute the prepared Statement and use the given values
save-ps save-ps <output file> Saves the prepared statements in memory -in xml format-

Update to 1.0:09.27.05 [Denison]
(09/27/05)

Have some people failing to get the drivers to load. At first I was skeptical...then I realized what was causing the fault.  The software is -NOT- configured to recognize .zip extensions as valid libraries. When I release the next version this will be corrected. 
Until then, grab the source and edit com.gravitysoft.sqltuil.ClassloadManager
on line 35 before the last ){ enter a new line and add:
|| item.getAbsolutePath().toUpperCase().endsWith(".ZIP")

The corrected code should look like this...
...
     if (item.isFile()
          && item.getAbsolutePath().toUpperCase().endsWith(".JAR")
          || item.getAbsolutePath().toUpperCase().endsWith(".ZIP")) {
...

then rerun ant to rebuild the application.

Stable Release 1.0:09.27.05 [Denison]
(09/27/05)

A lot of bug fixes, code modification and some basic optimization lead off.
However, the big change is the new STDOUT function.  It allows the program to
be ran in psudo-commandline mode.  It still requires a config file and doesn't
allow you to actually enter sql -at- the command line.
The new features can be used as follows:
***** Default Mode ***** 
edit conf/stdout.xml Set the parameters how you want them (explanation of files
is listed farther down)
java -jar shellraptor.jar --stdout
to config an use differant files, use 
java -jar shellraptor.jar --stdout=./conf/myShell.xml


**************** HELP COMMANDS ****************
	help			Available commands
	open <alias> <password>	Open a new connection based on 
                                     dbconfig entry. Password is optional
	list-alias			Show the list of available aliases in the 
                                     dbconfig file
	list-tables		List database tables
	list-dbinfo		List database information
	list-index <table>		Explain the index plan for the supplied 
                                     table
	-silent			Silent mode, no result sets returned
	-verbose			Verbose mode, result sets returned
	desc <table>		Describe the table schema
	select ...			basic sql commands
	drop <table>		Drop the given table
	create <table...>		Create the given table
	@<file>			Open and execute the listed file
	#<file> <sql>		save sql results to...
	#<file.out> @<file.in>	[reversable] Read in and write to..
	set maxrowcount <#>	Set the max @ of return results 
                                     (must be supported by 
                                     your supplied driver)
	exit			Exit the Application

	
ShellRaptor (2005): Command Line SQL Utility
Base Arguements
	 -s	<saveOutputTo_File>

	 -mx	<maximumRowCountResults>
	 -test	(-only- test connectivity)
	 -h	(this help screen)
	 --stdout	Use a config file (default is conf/xml) to execute command 
                                     from the command line to stdout
	 --stdout=<input.File>	Provide a config file to 
                                     executeConnection Arguements
1) no arguements uses default config file conf\dbconf.xml
2) External Config File
	-c	<config file>
3) Command Line Values
	-d	<driver>
	-u	<connection-url>

	-l	<username>
	-p	<password
 *** COMMENTS ***
 It is possible to use a config and override the values
 of that file by supplying driver, url..etc values.
 For example;
 java -jar ShellRaptor.jar -c myconf.xml -d newest.Version.ofSomeDriver.jar

 
Dev Notes: 
The new stdout command set presently only supports select.  I would like to 
add the delete, update and create functionality at some point but that will
have to wait for now. My work load is beyond imagination. 
alias			Name of the database alias in the 
                                     conf/dbconf.xml file
password 		Supply a password if one is not provided in the 
                                     conf/dbconf.xml file
outputfile  		Path and file to save output to. Setting this tag 
                                     as 'stdout' will
			pipe the output directly to the command line
delimiter			Delimiter used to separate the results. -NO- 
                                     default is provided
with-column-names	[true/false] Display column headers. -NO- 
                                     default is provided
silent			[true/false] Display connection, logging information. Used when the
			application is being called by external resources 
                                     and output needs
			to be piped to another file
 
StdOut Example File
<raptor>
        <stdout>
          <alias>default</alias>

          <password>shellraptor</password>
          <outputfile>x:/tmp/dc_test_out.csv</outputfile>
<!-- to dump to the command line only, set your outputfile = stdout
          <outputfile>stdout</outputfile>
-->

          <delimeter>^</delimeter>
          <sql>select * from ATBAT</sql>
<!-- pipe out columns name true/false -->
          <with-column-names>true</with-column-names>

<!-- Show -ONLY- results...not details true/false -->
          <silent>true</silent>
        </stdout>
</raptor>

Stable Release 1.0
(09/13/05)

Fully functional, stable release has been pushed to the mirrors. Testing has been done on Linux, Solaris, Mac and windows for Oracle, MySQL and SQLServer. This release now supports all of the following commands:
**************** HELP COMMANDS ****************
        help                   Available commands
        open <alias>       Open a new connection based on 
                                dbconfig entry
        list-alias             Show the list of available aliases in 
                                the dbconfig file
        list-tables           List database tables
        list-dbinfo           List database information
        list-index <table> Explain the index plan for the supplied table
        desc <table>       Describe the table schema
        select ...             basic sql commands
        drop <table>        Drop the given table
        create <table...>  Create the given table
        @<file>               Open and execute the listed file
        #<file> <sql>        save sql results to...
        #<file.out> @<file.in>  [reversible] Read in and write to..
        set maxrowcount <#>     Set the max @ of return results 
                                (must be supported by your supplied driver)
        exit                    Exit the Application
Development Notes I don't believe it was ever made clear that the program supports -multiple databases on demand-.  This is done by taking advantage of the 'open <alias>' command.  Open and configure conf/dbconf.xml.  If you download the source file I have included an example for mysql, oracle and sqllserver.

Quick tutorial on multiple database support.  Once you have connected from the shell editor execute
>> list-alias;
Alias [default]         U RL [jdbc:mysql://raptorDB/stattracker]
Alias [raptor-test]  URL [jdbc:oracle:thin:@raptorDB:1521:rtest]
Alias [raptor-prod]   URL [jdbc:oracle:thin:@raptorDB:1521:rprod]
Alias [ms-test]      URL [jdbc:microsoft:sqlserver://raptorDB:1433;DatabaseName=raptor]
-------------------------------------------
{Runtime: [0 seconds]}

>> open raptor-test;
OPEN CONNECTION [raptor-test]
Connectvity Info:
Driver [oracle.jdbc.OracleDriver]
URL [jdbc:oracle:thin:@raptorDB:1521:rtest]
Username [ioexcept]
Password [********]
Max Rows [-1]

[raptor-test] Connection status [Open]
>>

That's all there is to it. I hope helps in expressing some of the flexibility I have tried to instill into this application.

ShellRaptor, the idea
behind the technology
I work exclusively in the *nix environment and when I VPN in from the house during non-traditional business hours I always find myself needing to connect to one of the databases that are not mapped to any shell (MS SQLServer to be very precise).  This always causes mass problems and, in the end, forces me to drive up to work in the middle of the night and when it finally interrupted a solid raid in World of Warcraft I had had enough!  So here we are.
Purpose Provide users with a java based ( will run on any java compatible system that has a JRE/JDK installed) command line SQL utility/editor that supports any database that you can provide a TYPE-4 JDBC driver for.
How does it work? Drop your jar (only supports .jar extensions presently) into the $RAPTOR_HOME/lib folder and start the jar file: java -jar shellRaptor.jar 
Command Line
***** RUNTIME COMMANDS *****
ShellRaptor (2005): Command Line SQL Utility
Base Arguements
        -s     <saveOutputTo_File>

	-mx    <maximumRowCountResults>
        -test  (-only- test connectivity)
        -h     (this help screen)
 
Connection Arguments
1) no arguments uses default config file conf\dbconf.xml

2) External Config File
        -c      <config file>

3) Command Line Values
        -d      <driver>
        -u      <connection-url>
        -l      <username> 
        -p      <password
 
 *** COMMENTS ***
It is possible to use a config and override the values
of that file by supplying driver, url..etc values.
For example;
  java -jar ShellRaptor.jar -c myconf.xml \
  -d newest.Version.ofSomeDriver.jar
 
Author
I presently work as a Sr. Application Architect for an ATM transaction processing company.  I received my B.S. in Computer Science and a Masters in Information Technology specializing in Network Security/Computer Forensics. Linux is my operating system of choice and I work hard to keep on top of the new and exciting changes that Java brings to the development table. I am a strong advocate of the Open Source movement and remain very thankful to the SourceForge community.
 

Copyright 2005 Steve Gee, All Rights Reserved