Java Reference
In-Depth Information
I wish I could connect to one of these databases just by saying:
java com.darwinsys.sql.SQLRunner -c tmclub
But that won't work because I have to provide the driver JAR files in the CLASSPATH. So a
Unix shell script sqlrunner runs this java command and sets the classpath to include my
drivers. So I can say:
sqlrunner -c tmclub
This connects me to my Toastmasters Club [ 56 ] database. In this example, I select all the
meetings that are scheduled for the year 2014; just to show the use of different ResultsDec-
orator s, I then switch to HTML and print the resultset as HTML, which I paste into an
HTML page (in a web application, a servlet would get the results and call the ResultsDec-
orator directly):
SQLRunner: Loading driver org.postgresql.Driver
SQLRunner: Connecting to DB jdbc:postgresql:tmclub_alliston
SQLRunner: Connected to PostgreSQL
SQLRunner: ready.
select * from meetings where date > '2014-01-01';
Executing : select * from meetings where date > '2014-01-01'
id date theme maxspeakers roles_order
21 2014-01-07 Everything Old is New Again 7 null
22 2014-01-14 T.B.A. 7 null
23 2014-01-21 T.B.A. 7 null
24 2014-01-28 T.B.A. 7 null
25 2014-02-04 T.B.A. 7 null
26 2014-02-11 T.B.A. 7 null
27 2014-02-18 T.B.A. 7 null
28 2014-02-25 g Somehing New 7 null
29 2014-03-03 Spring is in the air? null null
2 2014-03-05 Peak Performance null null
30 2014-03-10 Peak Performance 5 null
31 2014-03-17 Spring Break null null
\mh;
select * from meetings where date > '2014-01-01';
Executing : select * from meetings where date > '2014-01-01'
<table border=1>
 
Search WWH ::




Custom Search