mSQL is a commercial Unix-dbase package created by Hughes, Australia.
It's free (including source) for all-but commercial use;
there are license agreements (reasonably priced) for commercial
use, i.e., including it in a product.
mSQL supports a subset of SQL, comes with a tiny admin tool,
an SQL interpreter, a script language, and a web-like scripting
language for server-side includes in webpages. They claim
strong performance with small data sets and reasonable performance
with large data sets.
mSQL and mSQL documentation can be found at:
http://www.hughes.com.au
% cp ~simha/java/ecom/msql-2.0.9.tar.gz ~/java/.
% gunzip msql-2.0.9.tar.gz
% tar -xvf msql-2.0.9.tar
% cd ~simha/java/ecom/msql-2.0.9/
% make target
This script discovers your machine and environment and creates
a configuration for compilation. The output to the screen
is something like:
Making target directory for Solaris-2.6-Sparc
Building directory tree.
Adding common
Adding conf
Adding lang-common
Adding lite
Adding makedepend
Adding makegen
Adding msql
Adding regexp
Adding tests
Adding tests/rtest.src
Adding w3-msql
Adding w3-msql/tests
Adding sym-links
............................................................
............................................................
Build of target directory for Solaris-2.6-Sparc complete
% cd targets/Solaris-2.6-Sparc/
% setup
The output is something like:
Starting configuration of mSQL 2.
creating cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
... [stuff left out]
Ready to build mSQL.
You may wish to check "site.mm" although the defaults should be
fine. When you're ready, type "make all" to build the software
n
msql-2.0.9/bin
% cd ~/java/msql-2.0.9/
% mkdir bin
INST_DIR= /home/joe/java/msql-2.0.9/bin
% make all
This will take time and produce a lot of output, something like:
Regenerating Makefile.
......................................................
Done.
Starting make for mSQL-2
--> [common] directory
Regenerating Makefile.
.....................................
...[stuff left out]
Make of mSQL-2 complete.
You should now install mSQL-2 using make install
% make install
This should produce output like:
Starting install for mSQL-2
...[stuff left out]
Installation of mSQL-2 complete.
% msql2d &
% msql testdb
msql> create table testtable (age integer) \g
This will create a table that you can work with, e.g.,
msql> select * from testtable \g
To shutdown the server, type:
% msqladmin shutdown
- Simply typing msqladmin will list commands.
% msqladmin create bank
% msql bank < bank_schema.sql
% gunzip mSQL-JDBC-1.tar.gz
% tar -xvf mSQL-JDBC-1.tar
setenv CLASSPATH /usr/local/jdk1.2/lib:$HOME/java/JSDK2.0/lib/jsdk.jar:$HOME/java/Jigsaw/Jigsaw/classes/jigsaw.zip:$HOME/java/mSQL-JDBC-1.0/msql-jdbc-1-0.jar:.
import java.sql.*;
import java.net.*;
import java.io.*;
public class TestJDBC {
public static void main(String args[]) {
// The SQL query.
String sql = "select * from emp";
System.out.println("Executing: " + sql);
// Create a driver instance.
try {
Class.forName("com.imaginary.sql.msql.MsqlDriver").newInstance();
// Make a connection.
String url = "jdbc:msql://localhost:8114/test";
Connection con = DriverManager.getConnection(url, "simha", "");
if (con == null) {
System.out.println ("Connection unsuccessful");
System.exit(0);
}
else {
System.out.println ("Connection successful. Continuing ...");
}
// Make a statement.
Statement s = con.createStatement();
if (s == null) {
System.out.println ("Statement creation unsuccessful");
System.exit(0);
}
else {
System.out.println ("Statement creation successful ... continuing");
}
// Execute the SQL statement.
if ( s.execute (sql) ) {
ResultSet r = s.getResultSet();
ResultSetMetaData meta = r.getMetaData();
int cols = meta.getColumnCount();
int rownum = 0;
// Iterate over the rows - get one row at a time.
while( r.next() ) {
rownum++;
System.out.println("Row: " + rownum);
for(int i=0; i<cols; i++) {
System.out.print(meta.getColumnLabel(i+1) + ": "
+ r.getObject(i+1) + ", ");
}
System.out.println("");
}
}
else {
System.out.println(s.getUpdateCount() + " rows affected.");
}
s.close();
con.close();
}
catch( Exception e ) {
e.printStackTrace();
}
}
}
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.net.*;
import java.io.*;
public class TestJDBCServlet extends HttpServlet {
public void doGet (HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
// Set the content type of the response.
resp.setContentType ("text/html");
// Create a PrintWriter to write the response.
java.io.PrintWriter out = new PrintWriter (resp.getOutputStream());
// The first part of the response.
out.println ("");
out.println ("