db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chaa...@apache.org
Subject svn commit: r1569470 - in /db/derby/code/trunk/java/demo: ./ nserverdemo/ scores/ scores/java/client/org/apache/derbyDemo/scores/data/ scores/java/server/org/apache/derbyDemo/scores/proc/ simple/ vtis/ workingwithderby/
Date Tue, 18 Feb 2014 18:46:03 GMT
Author: chaase3
Date: Tue Feb 18 18:46:02 2014
New Revision: 1569470

URL: http://svn.apache.org/r1569470
Log:
DERBY-6459  Remove Class.forName calls that load JDBC driver from Derby samples/demos

Modified 9 Java files and 7 documentation files, and replaced 2 documentation text files with HTML files.

Patch: DERBY-6459-2.diff

Added:
    db/derby/code/trunk/java/demo/scores/README.html
    db/derby/code/trunk/java/demo/vtis/README.html
Removed:
    db/derby/code/trunk/java/demo/scores/README
    db/derby/code/trunk/java/demo/vtis/README
Modified:
    db/derby/code/trunk/java/demo/demo.html
    db/derby/code/trunk/java/demo/navbar.html
    db/derby/code/trunk/java/demo/nserverdemo/NsSample.java
    db/derby/code/trunk/java/demo/nserverdemo/NsSampleClientThread.java
    db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkClientSample.java
    db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkServerSample.java
    db/derby/code/trunk/java/demo/nserverdemo/nserverdemo.html
    db/derby/code/trunk/java/demo/nserverdemo/readme.html
    db/derby/code/trunk/java/demo/nserverdemo/simpleserversample.html
    db/derby/code/trunk/java/demo/scores/customizeMe.properties
    db/derby/code/trunk/java/demo/scores/java/client/org/apache/derbyDemo/scores/data/Database.java
    db/derby/code/trunk/java/demo/scores/java/server/org/apache/derbyDemo/scores/proc/Functions.java
    db/derby/code/trunk/java/demo/simple/SimpleApp.java
    db/derby/code/trunk/java/demo/simple/example.html
    db/derby/code/trunk/java/demo/workingwithderby/WwdClientExample.java
    db/derby/code/trunk/java/demo/workingwithderby/WwdEmbedded.java
    db/derby/code/trunk/java/demo/workingwithderby/readme.html

Modified: db/derby/code/trunk/java/demo/demo.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/demo.html?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/demo.html (original)
+++ db/derby/code/trunk/java/demo/demo.html Tue Feb 18 18:46:02 2014
@@ -27,8 +27,8 @@
 <em class="fileName">demo/programs/</em> contains example databases and programs
 written in Java. Some of the sample programs are used as references in some of
 the Derby user manuals,
-see <A href="../../docs/html/getstart/index.html">Getting Started with Apache Derby</A> and 
-the <A href="../../docs/html/adminguide/index.html">Apache Derby Server and Administration Guide</A>.
+see <A href="../../docs/html/getstart/index.html"><i>Getting Started with Derby</i></A> and 
+the <A href="../../docs/html/adminguide/index.html"><i>Derby Server and Administration Guide</i></A>.
 Other programs are simply demonstrations of how to get started using Derby,
 or how to utilize certain features.</p>
 <UL>
@@ -44,32 +44,33 @@ An embedded connection is a connection t
 Client applications that require a database connection across the network use the network server protocol (DRDA) 
 to connect to the Network Server. This type of connection is referred to as a client connection.</p></LI>
 <LI><A href="toursdb/toursdb_readme.html">ToursDB sample database schema</a>
-    <p class="BodyRelative">The toursdb is provided as an example and demo database to illustrate some 
-functionality of the Derby RDBMS. Many of the examples in the Derby documentation use tables that exist in the toursdb database. 
+    <p class="BodyRelative">The <code>toursdb</code> database is provided as an example and demo database to illustrate some 
+functionality of the Derby RDBMS. Many of the examples in the Derby
+documentation use tables that exist in the <code>toursdb</code> database. 
 The document describes the tables, the names and types of columns in those tables, and the constraints, indexes, and triggers in the database.
     </p>
 </li>
 <LI><A href="workingwithderby/readme.html">Getting Started With Derby</A>
         <p class="BodyRelative">Programs described and modified as part of the activities documented in 
-the <A href="../../docs/html/getstart/index.html">Getting Started With Derby</A> manual.</p>
+the <A href="../../docs/html/getstart/index.html"><i>Getting Started With Derby</i></A> manual.</p>
 </LI>
 <LI><A href="scores/README" type="text/plain">Scores</A>
 <p class="BodyRelative">
-From Apachecon 2006 (Austin), this demo shows how to use user-coded Java
+This demo shows how to use user-coded Java
 functions and procedures inside the Derby engine.
 </p>
 </LI>
 <LI><A href="vtis/README" type="text/plain">VTIs</A>
 <p class="BodyRelative">This set of demos contains sample table functions for
 <ul>
-	<li>making a table out of a property file</li>
-	<li>making a table out of an XML file</li>
-	<li>making tables out of subversion logs, apache web server logs, and
-	JIRA reports.</li>
+<li>Making a table out of a property file</li>
+<li>Making a table out of an XML file</li>
+<li>Making tables out of subversion logs, Apache web server logs, and
+JIRA reports.</li>
 </ul>
 </p><p class="BodyRelative">
 In addition, this demo provides machinery for declaring and refreshing
-paramaterized subscriptions to data from foreign SQL databases.
+parameterized subscriptions to data from foreign SQL databases.
 </p>
 </LI>
 </UL>

Modified: db/derby/code/trunk/java/demo/navbar.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/navbar.html?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/navbar.html (original)
+++ db/derby/code/trunk/java/demo/navbar.html Tue Feb 18 18:46:02 2014
@@ -30,8 +30,8 @@
   <p class="NavBar1"><a href="nserverdemo/readme.html" target="mainPage">Network Server Sample Programs</a></p>
   <p class="NavBar1"><a href="toursdb/toursdb_readme.html" target="mainPage">ToursDB sample database schema</a></p>
   <p class="NavBar1"><a href="workingwithderby/readme.html" target="mainPage">Getting Started With Derby Activities Programs</a></p>
-  <p class="NavBar1"><a href="scores/README" type="text/plain" target="mainPage">Scores example</a></p>
-  <p class="NavBar1"><a href="vtis/README" type="text/plain" target="mainPage">VTI samples</a></p>
+  <p class="NavBar1"><a href="scores/README.html" target="mainPage">Scores example</a></p>
+  <p class="NavBar1"><a href="vtis/README.html" target="mainPage">VTI samples</a></p>
 </div>
 <p class="NavBar"><a href="http://db.apache.org/derby/manuals/index.html" target="_top">Online Documentation</a></p>
 

Modified: db/derby/code/trunk/java/demo/nserverdemo/NsSample.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/nserverdemo/NsSample.java?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/nserverdemo/NsSample.java (original)
+++ db/derby/code/trunk/java/demo/nserverdemo/NsSample.java Tue Feb 18 18:46:02 2014
@@ -41,20 +41,19 @@ import java.io.PrintWriter;
  The program:
 
  1.	starts the Derby Network Server
- 2.	loads the derby client JDBC driver
- 3. creates the database if not already created
- 4. checks to see if the schema is already created, and if not,
- 5. creates the schema which includes the table SAMPLETBL and corresponding indexes.
- 6. connects to the database
- 7. loads the schema by inserting data
- 8. starts client threads to perform database related operations
- 9. has each of the clients perform DML operations (select, insert, delete, update) using JDBC calls,
+ 2. creates the database if not already created
+ 3. checks to see if the schema is already created, and if not,
+ 4. creates the schema which includes the table SAMPLETBL and corresponding indexes.
+ 5. connects to the database
+ 6. loads the schema by inserting data
+ 7. starts client threads to perform database related operations
+ 8. has each of the clients perform DML operations (select, insert, delete, update) using JDBC calls,
     i)	 one client opens an embedded connection to perform database operations
          You can open an embedded connection in the same JVM that starts the Derby Network
          Server.
     ii)  one client opens a client connection to the Derby Network Server to perform database operations.
- 10.waits for the client threads to finish the tasks
- 11.shuts down the Derby Network Server at the end of the demo
+ 9. waits for the client threads to finish the tasks
+ 10.shuts down the Derby Network Server at the end of the demo
 
  <P>
  Usage: java nserverdemo.NsSample
@@ -149,16 +148,6 @@ public class NsSample {
 		pw.println("[NsSample] Sample Derby Network Server program demo starting. ");
 		pw.println("Please wait .....................");
 
-		// Load the JDBC Driver
-		try	{
-			Class.forName(jdbcDriver).newInstance();
-		} catch (Exception e) {
-			pw.println("[NsSample] Unable to load the JDBC driver. Following exception was thrown");
-			e.printStackTrace();
-			System.exit(1);  //critical error, so exit
-		  }
-
-
 		// See Derby documentation for description of properties that may be set
 		//  in the context of the network server.
 		Properties properties = new java.util.Properties();

Modified: db/derby/code/trunk/java/demo/nserverdemo/NsSampleClientThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/nserverdemo/NsSampleClientThread.java?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/nserverdemo/NsSampleClientThread.java (original)
+++ db/derby/code/trunk/java/demo/nserverdemo/NsSampleClientThread.java Tue Feb 18 18:46:02 2014
@@ -21,20 +21,16 @@
 
 package nserverdemo;
 
-import java.util.Properties;
-import java.sql.SQLException;
 import java.sql.DriverManager;
-import java.io.IOException;
 import java.sql.Statement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.sql.SQLWarning;
 import java.io.PrintWriter;
 import java.util.Properties;
 import java.sql.PreparedStatement;
 import java.sql.Connection;
 import java.util.Random;
-import java.lang.Math;
+
 /**
  * NsSampleClientThread thread to perform the NsSampleWork
  */

Modified: db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkClientSample.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkClientSample.java?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkClientSample.java (original)
+++ db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkClientSample.java Tue Feb 18 18:46:02 2014
@@ -33,14 +33,12 @@ import javax.sql.DataSource;
 /**
  * The primary purpose of this program is to demonstrate how to obtain
  * client connections using DriverManager or a DataSource
- * and interact with Derby Network Server
+ * and interact with Derby Network Server.
  *
  * In particular,this sample program
- * 1)   loads the Derby Network Client driver
-   (default is the derby network client driver)
- * 2)	obtains a client connection using the Driver Manager
- * 3)	obtains a client connection using a DataSource
- * 4)	tests the database connections by executing a sample query
+ * 1)	obtains a client connection using the DriverManager
+ * 2)	obtains a client connection using a DataSource
+ * 3)	tests the database connections by executing a sample query
  * and then exits the program
  *
  * Before running this program, please make sure that Derby Network Server is up
@@ -56,7 +54,7 @@ public class SimpleNetworkClientSample
 	 * The database is located in the same directory where this program is being
 	 * run. Alternately one can specify the absolute path of the database location
 	 */
-	private static String DBNAME="NSSampleDB";
+	private static String DBNAME="NSSimpleDB";
 
 	/**
 	 * Derby network server port ; default is 1527
@@ -68,7 +66,6 @@ public class SimpleNetworkClientSample
 	 * Derby Network Client Driver class names
 	 */
 
-public static final String DERBY_CLIENT_DRIVER = "org.apache.derby.jdbc.ClientDriver";
 	private static final String DERBY_CLIENT_DS = "org.apache.derby.jdbc.ClientDataSource";
 
 	/**
@@ -82,7 +79,6 @@ public static final String DERBY_CLIENT_
 
         // Default to using the Derby Client JDBC Driver for database connections
         String url = DERBY_CLIENT_URL;
-        String jdbcDriver = DERBY_CLIENT_DRIVER;
         String jdbcDataSource = DERBY_CLIENT_DS;
 
 	public static void main (String[] args) throws Exception
@@ -102,9 +98,6 @@ public static final String DERBY_CLIENT_
 		{
 			System.out.println("Starting Sample client program ");
 
-			// load  the appropriate JDBC Driver
-			loadDriver();
-
 			// get a client connection using DriverManager
 			clientConn1 = getClientDriverManagerConnection();
 			System.out.println("Got a client connection via the DriverManager.");
@@ -202,17 +195,6 @@ public static final String DERBY_CLIENT_
 
 	}
 
-
-	/**
-	 * Load the appropriate JDBC driver
-	 */
-	public void loadDriver()
-		throws Exception
-	{
-		// Load the  Driver
-		Class.forName(jdbcDriver).newInstance();
-	}
-
 	/**
 	 * Get a client connection using the DriverManager
 	 * @pre The JDBC driver must have been loaded before calling this method

Modified: db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkServerSample.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkServerSample.java?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkServerSample.java (original)
+++ db/derby/code/trunk/java/demo/nserverdemo/SimpleNetworkServerSample.java Tue Feb 18 18:46:02 2014
@@ -19,12 +19,14 @@
 
  */
 
-import java.sql.*;
-import javax.sql.DataSource;
 import org.apache.derby.drda.NetworkServerControl;
-import java.util.Properties;
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.sql.SQLException;
 
 /**
  * In order for a database to be consistent, only one JVM is allowed
@@ -32,11 +34,11 @@ import java.io.InputStreamReader;
  * is started. Hence, the JVM that starts the Network Server can get an
  * embedded connection to the same database that Network Server is accessing
  * to serve the clients from other JVMs. This solution allows you to take
- * advantage of the performance benefits of embedded driver as well as allow
+ * advantage of the performance benefits of the embedded driver as well as allow
  * for client connections from other JVMs to connect to the same database.
  *
  *
- * In particular,this sample program
+ * In particular, this sample program
  * 1) 	starts the Derby Network Server using a property and
  *		also loads the embedded driver
  * 2)	checks if the Derby Network Server is up and running
@@ -48,9 +50,9 @@ import java.io.InputStreamReader;
  * 7)	closes the connections
  * 8)	shuts down the Derby Network Server before exiting the program.
  *
- * Note, on running this program, there will be a NSSimpleDB database directory
- * created if not present already and there will be a derby.log file which
- * contains messages from Derby
+ * Note: On running this program, there will be a NSSimpleDB database directory
+ * created if not present already, and there will be a derby.log file which
+ * contains messages from Derby.
  *
  *  <P>
  *  Usage: java SimpleNetworkServerSample
@@ -61,7 +63,7 @@ public class SimpleNetworkServerSample
 
 	/*
 	 * The database is located in the same directory where this program is being
-	 * run. Alternately one can specify the absolute path of the database location
+	 * run. Alternatively, you can specify the absolute path of the database location
 	 */
 	private static String DBNAME="NSSimpleDB";
 
@@ -76,11 +78,11 @@ public class SimpleNetworkServerSample
 			startNetworkServer();
 
 			/*
-			  Can now spawn threads to do many wonderous things with
+			  Can now spawn threads to do many things with
 			  embedded connections but allow others to connect via
 			  Network Server. But for sample purposes, an embedded connection
 			  will be obtained and a sample query executed before waiting for
-			  the user to give input to shutdown the server.
+			  the user to give input to shut down the server.
 			*/
 
 		}
@@ -93,9 +95,9 @@ public class SimpleNetworkServerSample
 		try
 		{
 			// get an embedded connection
-			// Since Network Server was started in this jvm,  this JVM can get an embedded
-			// connection to the same database that Network Server
-			// is accessing to serve clients from other JVM's.
+			// Since the Network Server was started in this JVM, this JVM can get an embedded
+			// connection to the same database that the Network Server
+			// is accessing to serve clients from other JVMs.
 			// The embedded connection will be faster than going across the
 			// network
 			embeddedConn = getEmbeddedConnection(DBNAME,"create=true;");
@@ -125,7 +127,7 @@ public class SimpleNetworkServerSample
 				embeddedConn.close();
 			try
 			{
-				// shutdown Derby Network Server
+				// shut down Derby Network Server
 				DriverManager.getConnection("jdbc:derby:;shutdown=true");
 			}
 			catch(SQLException se)
@@ -140,24 +142,24 @@ public class SimpleNetworkServerSample
 	/**
 	 *  Setting the derby.drda.startNetworkServer property to true,
 	 *  either in the System properties as we do here or in
-	 *  the derby.properties file will cause Network Server to
+	 *  the derby.properties file, will cause the Network Server to
 	 *  start as soon as Derby is loaded.
 	 *
-	 *  To load Derby we just need to load the embedded
-	 *  Driver with:
+	 *  To load Derby, we just need to load the embedded
+	 *  driver with:
 	 *  Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
 	 *
 	 *  Then we will test for a while and make sure it is up, before
 	 *  we give up.
   	 *
-	 *  Alternately Network Server might be started from the command
+	 *  Alternatively, the Network Server might be started from the command
 	 *  line or from some other program. Note: only the JVM that starts
 	 *  Network Server can make an embedded connection.
 	 */
 
 	public static void startNetworkServer() throws Exception
 	{
-		// Start network server using the property
+		// Start the Network Server using the property
 		// and then wait for the server to start by testing a connection
 		startWithProperty();
 		waitForStart();
@@ -166,13 +168,13 @@ public class SimpleNetworkServerSample
 	/**
 	 * Start Derby Network Server using the property
 	 * derby.drda.startNetworkServer. This property can be set as a system property or
-	 * or by setting in derby.properties file.
-	 * Setting this property to true , starts the Network Server when
+	 * or in the derby.properties file.
+	 * Setting this property to true starts the Network Server when
 	 * Derby boots up.
-	 * The port at which the Derby Network Server listens to can be changed
+	 * The port at which the Derby Network Server listens can be changed
 	 * by setting the derby.drda.portNumber property. By default, the server starts
-	 * at port 1527
-	 * Server output goes to derby.log
+	 * at port 1527.
+	 * Server output goes to derby.log.
 	 */
 
 	private static void startWithProperty() throws Exception
@@ -180,7 +182,7 @@ public class SimpleNetworkServerSample
 		System.out.println("Starting Network Server");
 		System.setProperty("derby.drda.startNetworkServer","true");
 
-		// Booting derby
+		// Booting Derby
 		Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
 	}
 
@@ -188,7 +190,7 @@ public class SimpleNetworkServerSample
 
 	/**
 	 * Tries to check if the Network Server is up and running by calling ping
-	 * If successful, then it returns else tries for 50 seconds before giving up and throwing
+	 * If successful, it returns; otherwise, it tries for 50 seconds before giving up and throwing
 	 * an exception.
 	 * @throws Exception when there is a problem with testing if the Network Server is up
 	 * and running
@@ -199,9 +201,9 @@ public class SimpleNetworkServerSample
 		// Server instance for testing connection
 		org.apache.derby.drda.NetworkServerControl server = null;
 
-		// Use NetworkServerControl.ping() to wait for
-		// NetworkServer to come up.  We could have used
-		// NetworkServerControl to start the server but the property is
+		// Use NetworkServerControl.ping() to wait for the
+		// Network Server to come up.  We could have used
+		// NetworkServerControl to start the server, but the property is
 		// easier.
 		server = new NetworkServerControl();
 
@@ -228,15 +230,16 @@ public class SimpleNetworkServerSample
 	}
 
 	/**
-	 * Used to return an embedded Derby connection
+	 * Used to return an embedded Derby connection.
 	 * The protocol used is "jdbc:derby:dbName" where dbName is the database name
-	 * @pre the derby embedded jdbc driver must be loaded before calling this method
-	 * Alternately, if the derby network server is started in this jvm, then the embedded driver
+	 * @pre the Derby embedded JDBC driver must be loaded before calling
+	 * this method
+	 * Alternatively, if the Derby Network Server is started in this JVM, the embedded driver
 	 * org.apache.derby.jdbc.EmbeddedDriver is already loaded and it need not be loaded again.
 	 * @param	dbName	database name (ie location of the database)
 	 * @param 	attributes attributes for the database connection
-	 *			example, create=true;
-	 *					 upgrade=true;
+	 *			(for example, create=true;
+	 *					 upgrade=true;)
 	 * @return	returns embedded database connection
 	 * @throws Exception if there is any error
 	 */
@@ -287,10 +290,10 @@ public class SimpleNetworkServerSample
 
 
 	/**
-	 * This method waits until the user hits enter to stop the server
+	 * This method waits until the user presses Enter to stop the server
 	 * and eventually exit this program
 	 * Allows clients to continue to connect using client connections from other
-	 * jvms to Derby Network Server that was started in this program
+	 * JVMs to the Derby Network Server that was started in this program
 	 */
  	private static void waitForExit() throws Exception
  	{

Modified: db/derby/code/trunk/java/demo/nserverdemo/nserverdemo.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/nserverdemo/nserverdemo.html?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/nserverdemo/nserverdemo.html (original)
+++ db/derby/code/trunk/java/demo/nserverdemo/nserverdemo.html Tue Feb 18 18:46:02 2014
@@ -25,30 +25,32 @@
 Network Server sample program</H2>
 <P>The Network Server sample demo program (NsSample) is a simple JDBC application that 
 interacts with the Derby Network Server. The program:</P>
-<UL>
-  <LI>starts the Derby Network Server 
-  <LI>checks if the Derby Network Server is running 
-  <LI>loads the Derby Client Network JDBC Driver
-  <LI>creates the database '<tt>NsSampledb</tt>' if not already created 
-  <LI>checks to see if the schema is already created, and if not, 
-  creates the schema which includes the <tt>SAMPLETBL</tt> table and corresponding 
-  indexes. 
-  <LI>connects to the database 
-  <LI>loads the schema by inserting data 
-  <LI>starts client threads to perform database related operations 
-  <LI>has each of the clients perform DML operations (select, insert, delete, update) 
-  using JDBC calls, in particular one client opens an embedded connection to 
-  perform database operations while the other client opens a client connection 
-  to the Derby Network Server to perform database operations. 
-  <LI>waits for the client threads to finish the tasks 
-  <LI>shuts down the Derby Network Server at the end of the demo </LI></UL>
-<P>The following files should be installed in the <SPAN 
-class=italic>%DERBY_INSTALL%</SPAN><TT>\demo\programs\nserverdemo\</TT> directory in 
-order to run the sample program:</P>
+<OL>
+  <LI>Starts the Derby Network Server.</LI>
+  <LI>Connects to the Network Server and creates the database if not already
+  created. The Network Client driver is loaded automatically.</LI>
+  <LI>Checks to see if the schema is already created, and if not, </LI>
+  <LI>Creates the schema, which includes the <tt>SAMPLETBL</tt> table and 
+  corresponding indexes.</LI>
+  <LI>Connects to the database.</LI>
+  <LI>Loads the schema by inserting data.</LI>
+  <LI>Starts client threads to perform database related operations.</LI>
+  <LI>Has each of the clients perform DML operations (select, insert, delete, 
+  update) using JDBC calls; in particular, one client opens an embedded
+  connection to perform database operations, while the other client opens a
+  client connection to the Derby Network Server to perform database
+  operations.</LI> 
+  <LI>Waits for the client threads to finish the tasks.</LI>
+  <LI>Shuts down the Derby Network Server at the end of the demo.</LI>
+</OL>
+<P>The following files in the
+<TT><i>DERBY_INSTALL</i>\demo\programs\nserverdemo\</TT> directory are needed to
+run the sample program (<i>DERBY_INSTALL</i> is the directory where you
+installed Derby):</P>
 <UL>
   <LI><TT>NsSample.java</tt><br>
 This is the entry point into the demo application. The program starts up two clients. One client opens an embedded 
-connection to perform database operations while the other client opens a client 
+connection to perform database operations, while the other client opens a client 
 connection to the Derby Network Server to perform database operations.  This program provides the following constants that 
 can be changed to modify the sample demo:
 <UL>
@@ -60,7 +62,7 @@ can be changed to modify the sample demo
 </UL>
 
 You can also modify the program to exclude starting the Network Server as part of the sample program. 
-Make sure to recompile the java files before running the program if you make any 
+Make sure to recompile the Java files before running the program if you make any 
 changes to the source code.
 
 </li>
@@ -77,7 +79,7 @@ part of this sample program.</LI>
 </UL>
 </li>
   <LI><tt>NetworkServerUtil.java</tt><br>
-This file contains helper methods to start the Derby Network Server and to shutdown the server.
+This file contains helper methods to start the Derby Network Server and to shut down the server.
 </li>
   <LI>Compiled class files:
 <UL>
@@ -92,9 +94,7 @@ This file contains helper methods to sta
 <H2>Running the Network Server demo program</H2>
 <P>To run the Derby Network Server demonstration program:</P>
 <OL>
-  <LI>Open a command prompt and change directories to the <SPAN 
-  class=italic>%DERBY_INSTALL%</SPAN><tt>\demo\programs\</tt> directory, where <SPAN 
-  class=italic>%DERBY_INSTALL%</SPAN> is the directory where you installed Derby. 
+  <LI>Open a command prompt and change directories to the <tt><i>DERBY_INSTALL</i>\demo\programs\</tt> directory. 
   <LI>Set the CLASSPATH to the current directory (".") and also include the following 
   jar files in order to use the Derby Network Server and the Derby Client Network JDBC Driver.
 <ul>
@@ -105,8 +105,8 @@ Server functions.</li>
 </ul>
 </LI>
 <li>Test the CLASSPATH settings by running the following java command:<pre>java org.apache.derby.tools.sysinfo</pre>This command will show the Derby jar files that are in the CLASSPATH along with their respective versions.</li>
-<li>Once you have set up your environment correctly, execute the application from the <br> <SPAN 
-  class=italic>%DERBY_INSTALL%</SPAN><tt>\demo\programs\</tt> directory:<br>
+<li>Once you have set up your environment correctly, execute the application from the <br> 
+<tt><i>DERBY_INSTALL</i>\demo\programs\</tt> directory:<br>
 <pre>java nserverdemo.NsSample [driverType]</pre>
 <ul>
 <li>Where the possible values for driverType are:
@@ -122,45 +122,41 @@ program runs successfully:<br><br>
 <tt>
 Using JDBC driver: org.apache.derby.jdbc.ClientDriver<br>
 Derby Network Server created<br>
-Server is ready to accept connections on port 1621.<br>
-Connection number: 1.<br>
+Apache Derby Network Server started and ready to accept connections on port 1621<br>
 [NsSample] Derby Network Server started.<br>
 [NsSample] Sample Derby Network Server program demo starting. <br>
 Please wait .....................<br>
-Connection number: 2.<br>
-[NsSampleWork] Begin creating table - SAMPLETBL and necessary indexes. <br>
-[NsSampleClientThread] Thread id - 1; started.<br>
-[NsSampleWork] Thread id - 1; requests database connection, dbUrl =jdbc:derby:NSSampledb;<br>
+[NsSampleWork] Begin creating table - SAMPLETBL and necessary indexes.<br>
 [NsSampleClientThread] Thread id - 2; started.<br>
 [NsSampleWork] Thread id - 2; requests database connection, dbUrl =jdbc:derby://localhost:1621/NSSampledb;create=true;<br>
-Connection number: 3.<br>
-[NsSampleWork] Thread id - 1 selected 1 row [998,Derby41        ,2.92903314E14,9572]<br>
-[NsSampleWork] Thread id - 2 selected 1 row [998,Derby41        ,2.92903314E14,9572]<br>
-[NsSampleWork] Thread id - 1 selected 1 row [998,Derby41        ,2.92903314E14,9572]<br>
-[NsSampleWork] Thread id - 1 selected 1 row [998,Derby41        ,2.92903314E14,9572]<br>
-[NsSampleWork] Thread id - 1 selected 1 row [998,Derby41        ,2.92903314E14,9572]<br>
+[NsSampleClientThread] Thread id - 1; started.<br>
+[NsSampleWork] Thread id - 1; requests database connection, dbUrl =jdbc:derby:NSSampledb;<br>
 [NsSampleWork] Thread id - 1; inserted 1 row.<br>
-[NsSampleWork] Thread id - 1 selected 1 row [998,Derby41        ,2.92903314E14,9572]<br>
-[NsSampleWork] Thread id - 1 selected 1 row [52,Derby41        ,2.92903314E14,9572]<br>
-[NsSampleWork] Thread id - 1 selected 1 row [52,Derby41        ,2.92903314E14,9572]<br>
-[NsSampleWork] Thread id - 2; updated 1 row with t_key = 9572<br>
-[NsSampleWork] Thread id - 1; updated 1 row with t_key = 9572<br>
-[NsSampleWork] Thread id - 2 selected 1 row [53,Derby41        ,2.92903314E14,9572]<br>
 [NsSampleWork] Thread id - 1; inserted 1 row.<br>
+[NsSampleWork] Thread id - 1; deleted 1 row with t_key = 9372<br>
+[NsSampleWork] Thread id - 1 selected 1 row [920,Derby50        ,951.7808,9216]<br>
+[NsSampleWork] Thread id - 1 selected 1 row [920,Derby50        ,951.7808,9216]<br>
+[NsSampleWork] Thread id - 1; inserted 1 row.<br>
+[NsSampleWork] Thread id - 1 selected 1 row [920,Derby50        ,951.7808,9216]<br>
+[NsSampleWork] Thread id - 1; deleted 1 row with t_key = 9216<br>
+[NsSampleWork] Thread id - 1 selected 1 row [824,Derby26        ,8.802546E22,9155]<br>
+[NsSampleWork] Thread id - 1; updated 1 row with t_key = 9155<br>
 [NsSampleWork] Thread id - 1; closed connection to the database.<br>
 [NsSampleClientThread] Thread id - 1; finished all tasks.<br>
-[NsSampleWork] Thread id - 2; deleted 1 row with t_key = 9572<br>
-[NsSampleWork] Thread id - 2 selected 1 row [923,Derby14        ,4122.9033,9180]<br>
-[NsSampleWork] Thread id - 2; inserted 1 row.<br>
-[NsSampleWork] Thread id - 2 selected 1 row [923,Derby14        ,4122.9033,9180]<br>
+[NsSampleWork] Thread id - 2; updated 0 row with t_key = 9372<br>
+[NsSampleWork] Thread id - 2; updated 1 row with t_key = 9155<br>
+[NsSampleWork] Thread id - 2 selected 1 row [56,Derby26        ,8.802546E22,9155]<br>
 [NsSampleWork] Thread id - 2; inserted 1 row.<br>
-[NsSampleWork] Thread id - 2 selected 1 row [923,Derby14        ,4122.9033,9180]<br>
-[NsSampleWork] Thread id - 2 selected 1 row [923,Derby14        ,4122.9033,9180]<br>
+[NsSampleWork] Thread id - 2; updated 1 row with t_key = 9155<br>
+[NsSampleWork] Thread id - 2; deleted 1 row with t_key = 9155<br>
+[NsSampleWork] Thread id - 2 selected 1 row [785,Derby2         ,0.30170244,8280]<br>
+[NsSampleWork] Thread id - 2 selected 1 row [785,Derby2         ,0.30170244,8280]<br>
+[NsSampleWork] Thread id - 2; updated 1 row with t_key = 8280<br>
+[NsSampleWork] Thread id - 2 selected 1 row [59,Derby2         ,0.30170244,8280]<br>
 [NsSampleWork] Thread id - 2; closed connection to the database.<br>
 [NsSampleClientThread] Thread id - 2; finished all tasks.<br>
 [NsSample] Shutting down network server.<br>
-Connection number: 4.<br>
-Shutdown successful.<br>
+Apache Derby Network Server - shutdown<br>
 [NsSample] End of Network server demo.<br>
 <br>
 </tt>

Modified: db/derby/code/trunk/java/demo/nserverdemo/readme.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/nserverdemo/readme.html?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/nserverdemo/readme.html (original)
+++ db/derby/code/trunk/java/demo/nserverdemo/readme.html Tue Feb 18 18:46:02 2014
@@ -25,13 +25,13 @@
 <H1>Overview</H1>
 <p>The following example scenarios show you how to obtain an <em class="Emphasis">embedded connection</em> and <em class="Emphasis">client connections</em> using the Network Server to connect to the same database.</p>
 
-<p>An embedded connection is a connection to a database that is booted in the same JVM as the application. This connection can be obtained after the Derby Embedded driver is booted. The URL prefix is jdbc:derby:</p>
+<p>An embedded connection is a connection to a database that is booted in the same JVM as the application. The URL prefix is jdbc:derby:</p>
 
 <p>Client applications that require a database connection across the network use the network server protocol (DRDA) to connect to the Network Server. This type of connection is referred to as a client connection. The URL prefix is jdbc:derby:net:</p>
 <UL>
 </LI>
 <LI><p class="BodyRelative">First scenario: <A href="simpleserversample.html">Simple Network Server Sample</A></p>
-	<p class="BodyRelative">This example uses two programs to illustrate how a typical client program that starts up in its own JVM can connect to the Network Server that the server program starts. The client program (SimpleNetworkClientSample) and the server program (SimpleNetworkServerSample) each run in their own (different) JVMs. The example shows the Derby jar files that are needed at the client side and server side to use the Network Server. The SimpleNetworkClientSample program also shows how to use the DriverManger or a DataSource to obtain client connections.</p></LI></LI>
+	<p class="BodyRelative">This example uses two programs to illustrate how a typical client program that starts up in its own JVM can connect to the Network Server that the server program starts. The client program (SimpleNetworkClientSample) and the server program (SimpleNetworkServerSample) each run in their own (different) JVMs. The example shows the Derby jar files that are needed at the client side and server side to use the Network Server. The SimpleNetworkClientSample program also shows how to use the DriverManager or a DataSource to obtain client connections.</p></LI></LI>
 </LI>
 <LI><p class="BodyRelative">Second scenario: <A href="nserverdemo.html">Network Server Demo </A></p>
 	<p class="BodyRelative">This example program (NsSample) starts the network server and shows how to obtain client and embedded connections using the Network Server to connect to the same database, all in one JVM.</p></LI></LI>

Modified: db/derby/code/trunk/java/demo/nserverdemo/simpleserversample.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/nserverdemo/simpleserversample.html?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/nserverdemo/simpleserversample.html (original)
+++ db/derby/code/trunk/java/demo/nserverdemo/simpleserversample.html Tue Feb 18 18:46:02 2014
@@ -41,48 +41,42 @@ other JVMs. This solution allows you to 
 benefits of the embedded driver as well as allow for client connections from other
 JVMs to connect to the same database.</p>
 
-<p>In this example, the following two programs show how to setup the server and
+<p>In this example, the following two programs show how to set up the server and
 client programs when interacting with the Network Server.</p>
-
-<p>SimpleNetworkServerSample.java:
-This program starts the Derby Network Server as well as the embedded
-driver and waits for clients to connect.</p>
-
-<p>SimpleNetworkClientSample.java:
+<ul>
+<li><tt>SimpleNetworkServerSample.java</tt>:
+This program starts the Derby Network Server and waits for clients to
+connect.</li>
+<li><tt>SimpleNetworkClientSample.java</tt>:
 This is the client program that interacts with the Derby Network Server
-from another JVM.</p>
-
-<h3>SimpleNetworkServerSample program</h3>
+from another JVM.</li>
+</ul>
+<h2>SimpleNetworkServerSample program</h2>
 
 <p>In particular, this program:</p>
 
-<ul>
- <li>starts the Derby Network Server using a property and also loads the embedded driver</li>
- <li>checks if the Derby Network Server is up and running</li>
- <li>creates the database 'NSSimpleDB' if not already created </li>
- <li>obtains an embedded database connection</li>
- <li>tests the database connection by executing a sample query</li>
- <li>allows for client connections to connect to the server until the user decides to stop the server and exit the program</li>
- <li>closes the connection</li>
- <li>shuts down the Derby
-     Network Server before exiting the program.</li>
-</ul>
+<ol>
+ <li>Starts the Derby Network Server using a property and loads the
+     embedded driver</li>
+ <li>Checks if the Derby Network Server is up and running</li>
+ <li>Creates the database <tt>NSSimpleDB</tt> if not already created </li>
+ <li>Obtains an embedded database connection</li>
+ <li>Tests the database connection by executing a sample query</li>
+ <li>Allows client connections to connect to the server until the user decides to stop the server and exit the program</li>
+ <li>Closes the connection</li>
+ <li>Shuts down the Derby Network Server before exiting the program</li>
+</ol>
 
-<p>The following files should be installed in the <tt><i>DERBY_INSTALL</i>\demo\programs\nserverdemo\</span></tt> directory in
+<p>The following files are needed in the 
+<tt><i>DERBY_INSTALL</i>\demo\programs\nserverdemo\</span></tt> directory in
 order to run this sample program:</p>
 
 <ul>
- <li> Source file:</li>
- <ul>
-  <li><tt>SimpleNetworkServerSample.java</tt></li>
- </ul>
- <li>Compiled class file:</li>
- <ul>
-  <li><tt>SimpleNetworkServerSample.class</tt></li>
- </ul>
+ <li>Source file: <br><tt>SimpleNetworkServerSample.java</tt></li>
+ <li>Compiled class file: <br><tt>SimpleNetworkServerSample.class</tt></li>
 </ul>
 
-<h2>How to run the SimpleNetworkServerSample program</h2>
+<h3>How to run the SimpleNetworkServerSample program</h3>
 
 <p>To run this simple Derby Network Server sample program:</p>
 
@@ -92,7 +86,7 @@ order to run this sample program:</p>
      where you installed Derby.</li>
  <li>Set the CLASSPATH to include the following jar files in order to run this
      program.</li>
-<ul><li>the current directory (".")</li>
+<ul><li>The current directory (".")</li>
 <li><tt>derbynet.jar</tt>: <BR>The Network Server jar file. It must be in your CLASSPATH since we start the Network Server in this program.</li>
 <li><tt>derby.jar</tt>: <BR>The Derby database engine jar file.</li>
 </ul>
@@ -109,23 +103,24 @@ order to run this sample program:</p>
 </li></ol>
 <p>You should receive output similar to the following if the program runs successfully:</p>
 
-<tt>
-Starting Network Server<br>
-Testing if Network Server is up and running!<br>
-Derby Network Server now running<br>
-Got an embedded connection.<br>
-Testing embedded connection by executing a sample query <br>
-number of rows in sys.systables = 16<br>
-<br>
-While my app is busy with embedded work, ij might connect like this:<br>
-<br>
-        $ java -Dij.user=me -Dij.password=pw -Dij.protocol=jdbc:derby://localhost:1527/ org.apache.derby.tools.ij<br>
-        ij> connect 'NSSimpleDB';<br>
-<br>
-<br>
-Clients can continue to connect: <br>
-Press [Enter] to stop Server<br>
-</tt>
+<pre>
+Starting Network Server
+Testing if Network Server is up and running!
+Derby Network Server now running
+Got an embedded connection.
+Testing embedded connection by executing a sample query 
+number of rows in sys.systables = 23
+
+While my app is busy with embedded work, ij might connect like this:
+
+        $ java -Dij.user=me -Dij.password=pw -Dij.protocol=jdbc:derby://localhost:1527/ org.apache.derby.tools.ij
+        ij> connect 'NSSimpleDB';
+
+Clients can continue to connect: 
+Press [Enter] to stop Server
+</pre>
+<p><b>Do not press Enter at this time.</b> Leave the server running while you run the
+<tt>SimpleNetworkClientSample</tt> program.</p>
 
 <p>Running this program will also create new directories and files:</p>
 
@@ -138,19 +133,18 @@ This log file contains Derby progress an
 </li></ul>
 
 
-<h2>Example of a Client connecting to the Network Server</h2>
+<h2>Example of a client connecting to the Network Server</h2>
 
 <h3>SimpleNetworkClientSample program</h3>
 
 <p>This program:</p>
 
-<ul>
- <li>loads the Derby Network Client JDBC Driver</li>
- <li>obtains a client connection using the Driver Manager</li>
- <li>obtains a client connection using a DataSource</li>
- <li>tests the database connections by executing a sample query</li>
- <li>closes the connections and then exits the program.</li>
-</ul>
+<ol>
+ <li>Obtains a client connection using the DriverManager</li>
+ <li>Obtains a client connection using a DataSource</li>
+ <li>Tests the database connections by executing a sample query</li>
+ <li>Closes the connections and then exits the program</li>
+</ol>
 
 <p>The following files should be installed in the <tt><i>DERBY_INSTALL</i>\demo\programs\nserverdemo\</tt> directory in order to run this sample program:</p>
 <ul>
@@ -158,19 +152,21 @@ This log file contains Derby progress an
  <li>Compiled class file: <br><tt>SimpleNetworkClientSample.class</tt></li>
 </ul>
 
-<h2>How to run the SimpleNetworkClientSample program</h2>
+<h3>How to run the SimpleNetworkClientSample program</h3>
 
-<p>To connect to the Network Server that has been started as part of the SimpleNetworkServerSample program:</p>
+<p>To connect to the Network Server:</p>
 
 <ol>
- <li>Open a command prompt and change directories to the <tt><i>DERBY_INSTALL</i>\demo\programs\nserverdemo</tt> directory, where <tt><i>DERBY_INSTALL</i></tt> is the directory where you installed Derby.</li>
+ <li>Open another command prompt and change directories to the
+     <tt><i>DERBY_INSTALL</i>\demo\programs\nserverdemo</tt> directory, where
+     <tt><i>DERBY_INSTALL</i></tt> is the directory where you installed Derby.</li>
  <li>Clients of Derby Network Server only need the following jar files in the CLASSPATH in order to connect to the Network Server.<span>  </span>Set the CLASSPATH to include the following jar files:
  <ul>
-  <li>the current directory (".")</li>
-<li><tt>derbyclient.jar</tt><br>This jar file must be in your CLASSPATH to use
+  <li>The current directory (".")</li>
+  <li><tt>derbyclient.jar</tt><br>This jar file must be in your CLASSPATH to use
 the Derby Client Network JDBC Driver.</li>
  </ul></li>
-<li>Once you have set up your environment correctly, execute the
+  <li>Once you have set up your environment correctly, execute the
 application from the <tt><i>DERBY_INSTALL</i>\demo\programs\nserverdemo\</tt> directory:
 <pre><tt>java SimpleNetworkClientSample [<i>driverType</i>]</tt></pre>
 <p>where the possible values for <i>driverType</i> are:</p>
@@ -189,12 +185,14 @@ Got a client connection via the DriverMa
 connection from datasource; getDriverName = Apache Derby Network Client JDBC Driver<br>
 Got a client connection via a DataSource.<br>
 Testing the connection obtained via DriverManager by executing a sample query <br>
-number of rows in sys.systables = 16<br>
+number of rows in sys.systables = 23<br>
 Testing the connection obtained via a DataSource by executing a sample query <br>
-number of rows in sys.systables = 16<br>
+number of rows in sys.systables = 23<br>
 Goodbye!<br>
 </tt>
 
+<p>After running the program, return to the command prompt where you ran the
+<tt>SimpleNetworkServerSample</tt> program and press Enter.</p>
 </body>
 
 </html>

Added: db/derby/code/trunk/java/demo/scores/README.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/scores/README.html?rev=1569470&view=auto
==============================================================================
--- db/derby/code/trunk/java/demo/scores/README.html (added)
+++ db/derby/code/trunk/java/demo/scores/README.html Tue Feb 18 18:46:02 2014
@@ -0,0 +1,62 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to you under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<link rel="StyleSheet" href="../csfull.css" type="text/css" media="screen">
+<title>Scores Demo</title>
+</head>
+<body>
+<h1 class="Title">Scores Demo</h1>
+<p>The <code><i>DERBY_HOME</i>/demo/programs/scores</code> directory contains a
+demo application which shows how you can run user-written Java code inside the
+Derby database.</p>
+<p>To see the Ant targets that enable you to build and run the demo application,
+cd to this directory and type the following command:</p>
+<pre>
+   ant -projecthelp
+</pre>
+<p>Follow the instructions in the command output. You may need to download the
+Jakarta Commons Math library from the Apache web site. After customizing a
+property, you will use the <code>ant run</code> command to run the
+application.</p>
+<p>The demo shows you how to do the following:</p>
+<ul>
+<li>Declare Java functions and procedures and run them inside the Derby
+   engine</li>
+<li>Load the Derby engine with jar files of user-written code</li>
+<li>Enforce data consistency by wiring functions into CREATE TABLE
+   statements</li>
+<li>Run a Java procedure from a TRIGGER</li>
+<li>Improve query performance by wiring filtering functions into the
+   WHERE clause</li>
+<li>Format query output by wiring functions into the SELECT list</li>
+<li>Re-use off-the-shelf packages to write your own custom data aggregator</li>
+</ul>
+<p>For more detail, please consult the following sections of the <i>Derby
+Developer's Guide</i>:</p>
+<ul>
+<li>"Loading classes from a database"</li>
+<li>"Derby server-side programming"</li>
+</ul>
+<hr>
+<p class=NavBarVersion>Last updated for Apache Derby Version 10.11</p>
+</body>
+</html>
+
+

Modified: db/derby/code/trunk/java/demo/scores/customizeMe.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/scores/customizeMe.properties?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/scores/customizeMe.properties (original)
+++ db/derby/code/trunk/java/demo/scores/customizeMe.properties Tue Feb 18 18:46:02 2014
@@ -24,7 +24,4 @@ derby.lib=../../../jars/insane
 #
 # Location of the Jakarta commons math library
 #
-math.library=../../../../../../sw/commonsMath/commons-math-1.1/commons-math-1.1.jar
-
-
-
+math.library=../../../../../../sw/commonsMath/commons-math3-3.2/commons-math3-3.2.jar

Modified: db/derby/code/trunk/java/demo/scores/java/client/org/apache/derbyDemo/scores/data/Database.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/scores/java/client/org/apache/derbyDemo/scores/data/Database.java?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/scores/java/client/org/apache/derbyDemo/scores/data/Database.java (original)
+++ db/derby/code/trunk/java/demo/scores/java/client/org/apache/derbyDemo/scores/data/Database.java Tue Feb 18 18:46:02 2014
@@ -140,15 +140,6 @@ public  class   Database
         throws SQLException
     {
         if ( _conn != null ) { return _conn; }
-        
-        try {
-            Class.forName( DERBY_EMBEDDED_DRIVER );
-        }
-        catch (ClassNotFoundException e)
-        {
-            throw new SQLException
-                ( "Could not locate " + DERBY_EMBEDDED_DRIVER );
-        }
 
         String      connectionURL =
             DERBY_PROTOCOL + DATABASE_NAME + CREATE_ME;

Modified: db/derby/code/trunk/java/demo/scores/java/server/org/apache/derbyDemo/scores/proc/Functions.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/scores/java/server/org/apache/derbyDemo/scores/proc/Functions.java?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/scores/java/server/org/apache/derbyDemo/scores/proc/Functions.java (original)
+++ db/derby/code/trunk/java/demo/scores/java/server/org/apache/derbyDemo/scores/proc/Functions.java Tue Feb 18 18:46:02 2014
@@ -25,7 +25,7 @@ import java.sql.*;
 import java.text.*;
 import java.util.*;
 
-import org.apache.commons.math.stat.descriptive.rank.Median;
+import org.apache.commons.math3.stat.descriptive.rank.Median;
 
 import org.apache.derbyDemo.scores.util.*;
 

Modified: db/derby/code/trunk/java/demo/simple/SimpleApp.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/simple/SimpleApp.java?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/simple/SimpleApp.java (original)
+++ db/derby/code/trunk/java/demo/simple/SimpleApp.java Tue Feb 18 18:46:02 2014
@@ -47,15 +47,14 @@ import java.util.Properties;
  * starts up the Derby engine.</p>
  * <p>
  * When Derby runs in a client/server framework, the application runs in a
- * different JVM from Derby. The application only needs to load the client
- * driver, and the connectivity framework (in this case the Derby Network
- * Server) provides network connections.</p>
+ * different JVM from Derby. The connectivity framework (in this case the Derby
+ * Network Server) provides network connections. The client driver is loaded
+ * automatically.</p>
  */
 public class SimpleApp
 {
-    /* the default framework is embedded*/
+    /* the default framework is embedded */
     private String framework = "embedded";
-    private String driver = "org.apache.derby.jdbc.EmbeddedDriver";
     private String protocol = "jdbc:derby:";
 
     /**
@@ -96,8 +95,8 @@ public class SimpleApp
 
     /**
      * <p>
-     * Starts the actual demo activities. This includes loading the correct
-     * JDBC driver, creating a database by making a connection to Derby,
+     * Starts the actual demo activities. This includes creating a database by
+     * making a connection to Derby (automatically loading the driver),
      * creating a table in the database, and inserting, updating and retrieving
      * some data. Some of the retrieved data is then verified (compared) against
      * the expected results. Finally, the table is deleted and, if the embedded
@@ -121,9 +120,6 @@ public class SimpleApp
 
         System.out.println("SimpleApp starting in " + framework + " mode");
 
-        /* load the desired JDBC driver */
-        loadDriver();
-
         /* We will be using Statement and PreparedStatement objects for
          * executing SQL. These objects, as well as Connections and ResultSets,
          * are resources that should be released explicitly after use, hence
@@ -132,13 +128,10 @@ public class SimpleApp
          * in an array list for convenience.
          */
         Connection conn = null;
-	/* This ArrayList usage may cause a warning when compiling this class
-	 * with a compiler for J2SE 5.0 or newer. We are not using generics
-	 * because we want the source to support J2SE 1.4.2 environments. */
         ArrayList<Statement> statements = new ArrayList<Statement>(); // list of Statements, PreparedStatements
-        PreparedStatement psInsert = null;
-        PreparedStatement psUpdate = null;
-        Statement s = null;
+        PreparedStatement psInsert;
+        PreparedStatement psUpdate;
+        Statement s;
         ResultSet rs = null;
         try
         {
@@ -392,43 +385,6 @@ public class SimpleApp
     }
 
     /**
-     * Loads the appropriate JDBC driver for this environment/framework. For
-     * example, if we are in an embedded environment, we load Derby's
-     * embedded Driver, <code>org.apache.derby.jdbc.EmbeddedDriver</code>.
-     */
-    private void loadDriver() {
-        /*
-         *  The JDBC driver is loaded by loading its class.
-         *  If you are using JDBC 4.0 (Java SE 6) or newer, JDBC drivers may
-         *  be automatically loaded, making this code optional.
-         *
-         *  In an embedded environment, this will also start up the Derby
-         *  engine (though not any databases), since it is not already
-         *  running. In a client environment, the Derby engine is being run
-         *  by the network server framework.
-         *
-         *  In an embedded environment, any static Derby system properties
-         *  must be set before loading the driver to take effect.
-         */
-        try {
-            Class.forName(driver).newInstance();
-            System.out.println("Loaded the appropriate driver");
-        } catch (ClassNotFoundException cnfe) {
-            System.err.println("\nUnable to load the JDBC driver " + driver);
-            System.err.println("Please check your CLASSPATH.");
-            cnfe.printStackTrace(System.err);
-        } catch (InstantiationException ie) {
-            System.err.println(
-                        "\nUnable to instantiate the JDBC driver " + driver);
-            ie.printStackTrace(System.err);
-        } catch (IllegalAccessException iae) {
-            System.err.println(
-                        "\nNot allowed to access the JDBC driver " + driver);
-            iae.printStackTrace(System.err);
-        }
-    }
-
-    /**
      * Reports a data verification failure to System.err with the given message.
      *
      * @param message A message describing what failed.
@@ -461,15 +417,15 @@ public class SimpleApp
     }
 
     /**
-     * Parses the arguments given and sets the values of this class' instance
-     * variables accordingly - that is which framework to use, the name of the
-     * JDBC driver class, and which connection protocol protocol to use. The
+     * Parses the arguments given and sets the values of this class's instance
+     * variables accordingly - that is, which framework to use, the name of the
+     * JDBC driver class, and which connection protocol to use. The
      * protocol should be used as part of the JDBC URL when connecting to Derby.
      * <p>
      * If the argument is "embedded" or invalid, this method will not change
      * anything, meaning that the default values will be used.</p>
      * <p>
-     * @param args JDBC connection framework, either "embedded", "derbyclient".
+     * @param args JDBC connection framework, either "embedded" or "derbyclient".
      * Only the first argument will be considered, the rest will be ignored.
      */
     private void parseArguments(String[] args)
@@ -478,7 +434,6 @@ public class SimpleApp
             if (args[0].equalsIgnoreCase("derbyclient"))
             {
                 framework = "derbyclient";
-                driver = "org.apache.derby.jdbc.ClientDriver";
                 protocol = "jdbc:derby://localhost:1527/";
             }
         }

Modified: db/derby/code/trunk/java/demo/simple/example.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/simple/example.html?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/simple/example.html (original)
+++ db/derby/code/trunk/java/demo/simple/example.html Tue Feb 18 18:46:02 2014
@@ -46,22 +46,22 @@
   This example program is a minimal JDBC application written in Java. JDBC is
   the primary API for interacting with Apache Derby using Java. This program:
 </p>
-<ul class="Normal">
-  <li class="Normal">runs in either embedded mode (the default) or as a client in a client/server environment, depending on the arguments passed to the program
-  <li class="Normal">starts up the Derby engine, if running in embedded mode
-  <li class="Normal">connects to the Derby Network Server, if running in client mode
-  <li class="Normal">creates and connects to a database
-  <li class="Normal">creates a table
-  <li class="Normal">inserts data
-  <li class="Normal">updates data
-  <li class="Normal">selects data
-  <li class="Normal">drops a table
-  <li class="Normal">disconnects
-  <li class="Normal">shuts down the database, if running in embedded mode
-</ul>
+<ol class="Normal">
+  <li class="Normal">Runs in either embedded mode (the default) or as a client in a client/server environment, depending on the arguments passed to the program
+  <li class="Normal">Starts up the Derby engine, if running in embedded mode
+  <li class="Normal">Connects to the Derby Network Server, if running in client mode
+  <li class="Normal">Creates and connects to a database
+  <li class="Normal">Creates a table
+  <li class="Normal">Inserts data
+  <li class="Normal">Updates data
+  <li class="Normal">Selects data
+  <li class="Normal">Drops a table
+  <li class="Normal">Disconnects
+  <li class="Normal">Shuts down the database, if running in embedded mode
+</ol>
 <p>
   This program is intended to run in Virtual Machines for the Java Platform
-  supporting J2SE 1.4.2 or newer.
+  supporting Java SE 6 or newer.
 </p>
 <p>
   In embedded mode, the application starts up an instance of Derby within the
@@ -133,8 +133,8 @@ path separators and environment variable
   <a href="http://db.apache.org/derby" target="_new">Apache Derby web site</a>.
 </p>
 <p>
-  If you are relatively new to databases or JDBC,
-  <a href="http://java.sun.com/docs/books/tutorial/jdbc/basics/index.html" target="_new">Sun's
+  If you are relatively new to databases or JDBC, the
+  <a href="http://docs.oracle.com/javase/tutorial/jdbc/basics/index.html" target="_new">Oracle
   JDBC basics tutorial</a> may be a good starting point.
 </p>
 
@@ -323,7 +323,6 @@ NOT FOUND IN CLASS PATH:
     <p class="BodyRelative">A successful run produces the following output:</p>
     <pre class="Output">
 SimpleApp starting in embedded mode
-Loaded the appropriate driver
 Connected to and created database derbyDB
 Created table location
 Inserted 1956 Webster
@@ -496,7 +495,6 @@ SUCCESS: All Derby related classes found
     <p class="BodyRelative">A successful run produces the following output:</p>
     <pre class="Output">
 SimpleApp starting in derbyclient mode
-Loaded the appropriate driver
 Connected to and created database derbyDB
 Created table location
 Inserted 1956 Webster
@@ -517,7 +515,7 @@ SimpleApp finished
 
 <!-- ##########  FOOTER (VERSION INFO)  ########## -->
 <hr>
-<p class=NavBarVersion>Last updated for Apache Derby Version 10.3.2</p>
+<p class=NavBarVersion>Last updated for Apache Derby Version 10.11</p>
 
 </body>
 </html>

Added: db/derby/code/trunk/java/demo/vtis/README.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/vtis/README.html?rev=1569470&view=auto
==============================================================================
--- db/derby/code/trunk/java/demo/vtis/README.html (added)
+++ db/derby/code/trunk/java/demo/vtis/README.html Tue Feb 18 18:46:02 2014
@@ -0,0 +1,48 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to you under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<link rel="StyleSheet" href="../csfull.css" type="text/css" media="screen">
+<title>Table Functions Demo</title>
+</head>
+<body>
+<h1 class="Title">Table Functions Demo</h1>
+<p>The <code><i>DERBY_HOME</i>/demo/programs/vtis</code> directory contains
+sample table functions.</p>
+<p>This code is now built as part of the standard Derby build.
+To build the API documentation, invoke the <code>demodocs</code> target in the
+top-level build script.</p>
+<p>An <code>.sql</code> script, <code>sql/demoFileVtis.sql</code>, is provided
+to test-drive these table functions. Use Derby's <code>ij</code> tool to run
+this script. The script needs to be customized as explained in its header.</p>
+<p>This script exercises the following table functions:</p>
+<ul>
+<li><code>PropertyFileVTI</code> - a table function for presenting a property
+file as a table</li>
+<li><code>ApacheServerLogVTI</code> - an example of an
+<code>org.apache.derby.vti.XmlVTI</code> which makes a table out of an Apache
+web server log</li>
+<li><code>DerbyJiraReportVTI</code> - an example of an
+<code>org.apache.derby.vti.XmlVTI</code> which makes a table out of a JIRA
+report</li>
+<li><code>SubversionLogVTI</code> - a table function for making a table from the
+output of the <code>svn log</code> command</li>
+</ul>
+</body>
+</html>

Modified: db/derby/code/trunk/java/demo/workingwithderby/WwdClientExample.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/workingwithderby/WwdClientExample.java?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/workingwithderby/WwdClientExample.java (original)
+++ db/derby/code/trunk/java/demo/workingwithderby/WwdClientExample.java Tue Feb 18 18:46:02 2014
@@ -46,25 +46,12 @@ public class WwdClientExample
         +  " WISH_ITEM VARCHAR(32) NOT NULL) " ;
       String answer;
 
-      //   Beginning of JDBC code sections   
-      //   ## LOAD DRIVER SECTION ##
-      try	        {
-          /*
-          **  Load the Derby driver. 
-          **     When the embedded Driver is used this action start the Derby engine.
-          **  Catch an error and suggest a CLASSPATH problem
-           */
-          Class.forName(driver); 
-          System.out.println(driver + " loaded. ");
-      } catch(java.lang.ClassNotFoundException e)     {
-          System.err.print("ClassNotFoundException: ");
-          System.err.println(e.getMessage());
-          System.out.println("\n    >>> Please check your CLASSPATH variable   <<<\n");
-      }
+      //   JDBC code sections   
       //  Beginning of Primary DB access section
       //   ## BOOT DATABASE SECTION ##
      try {
-            // Create (if needed) and connect to the database
+            // Create (if needed) and connect to the database.
+            // The driver is loaded automatically.
             conn = DriverManager.getConnection(connectionURL);		 
             System.out.println("Connected to database " + dbName);
             

Modified: db/derby/code/trunk/java/demo/workingwithderby/WwdEmbedded.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/workingwithderby/WwdEmbedded.java?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/workingwithderby/WwdEmbedded.java (original)
+++ db/derby/code/trunk/java/demo/workingwithderby/WwdEmbedded.java Tue Feb 18 18:46:02 2014
@@ -50,25 +50,12 @@ public class WwdEmbedded
         +  " WISH_ITEM VARCHAR(32) NOT NULL) " ;
       String answer;
 
-      //   Beginning of JDBC code sections   
-      //   ## LOAD DRIVER SECTION ##
-      try	        {
-          /*
-          **  Load the Derby driver. 
-          **     When the embedded Driver is used this action start the Derby engine.
-          **  Catch an error and suggest a CLASSPATH problem
-           */
-          Class.forName(driver); 
-          System.out.println(driver + " loaded. ");
-      } catch(java.lang.ClassNotFoundException e)     {
-          System.err.print("ClassNotFoundException: ");
-          System.err.println(e.getMessage());
-          System.out.println("\n    >>> Please check your CLASSPATH variable   <<<\n");
-      }
+      //  JDBC code sections   
       //  Beginning of Primary DB access section
       //   ## BOOT DATABASE SECTION ##
      try {
-            // Create (if needed) and connect to the database
+            // Create (if needed) and connect to the database.
+            // The driver is loaded automatically.
             conn = DriverManager.getConnection(connectionURL);		 
             System.out.println("Connected to database " + dbName);
             

Modified: db/derby/code/trunk/java/demo/workingwithderby/readme.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/demo/workingwithderby/readme.html?rev=1569470&r1=1569469&r2=1569470&view=diff
==============================================================================
--- db/derby/code/trunk/java/demo/workingwithderby/readme.html (original)
+++ db/derby/code/trunk/java/demo/workingwithderby/readme.html Tue Feb 18 18:46:02 2014
@@ -25,36 +25,41 @@
 <BODY>
 
 <H1>The Getting Started With Derby Sample Programs</H1>
-<P>The programs in this directory are described in the the <A href="../../../docs/html/getstart/index.html">Getting Started With Derby</A> manual. Please see this document for more information.</P>
+<P>The programs in this directory are described in the the 
+<A href="../../../docs/html/getstart/index.html"><i>Getting Started With Derby</i></A>
+manual. Please see this document for more information.</P>
 <UL>
   <LI>
-  <p class="BodyRelative"><A href="WwdEmbedded.java">WwdEmbedded.java</A></p>
-  <p class="BodyRelative">A very basic JDBC program that uses Derby. This is the primary program
-  example used in the JDBC sections of Getting Started With Derby. It is described
-  in detail in that document.</p>
+  <p class="BodyRelative">
+  <A href="WwdEmbedded.java" type="text/plain"><code>WwdEmbedded.java</code></A></p>
+  <p class="BodyRelative">A very basic JDBC program that uses Derby. This is 
+  the primary program example used in the JDBC sections of <i>Getting Started With
+  Derby</i>. It is described in detail in that manual.</p>
   </LI>
-  <LI><p class="BodyRelative"><A href="WwdClientExample.java">WwdClientExample.java</A></p>
-	<p class="BodyRelative">This is an example of what the WwdClient.java program created as part
-  of one of the Getting Started With Derby activities will look like. A working copy of that code
+  <LI><p class="BodyRelative">
+  <A href="WwdClientExample.java" type="text/plain"><code>WwdClientExample.java</code></A></p>
+  <p class="BodyRelative">This is an example of what the <code>WwdClient.java</code> program created as part
+  of one of the <i>Getting Started With Derby</i> activities will look like. A working copy of that code
   is provided here for people interested in examining the code without performing
   the edits described in the activity.</p></LI>
 </UL>
 <UL>
-  <LI><p class="BodyRelative"><A href="WwdUtils.java">WwdUtils.java</A></p>
-<P class="BodyRelative">These are utility methods used by the Getting Started With Derby programs that
-are not described in the document. The processing performed by these methods
+  <LI><p class="BodyRelative"><A href="WwdUtils.java" type="text/plain"><code>WwdUtils.java</code></A></p>
+<P class="BodyRelative">These are utility methods used by the <i>Getting Started With Derby</i> programs that
+are not described in the manual. The processing performed by these methods
 does not demonstrate basic JDBC processing and so is outside the scope
-of an introductory document like Getting Started With Derby. These methods provide
+of an introductory manual like <i>Getting Started With Derby</i>. These methods provide
 environment validation and manage user input so the program is more robust.
 The code is provided here for people interested in examining the processing.
 It contains three methods:</P>
 <OL>
-  <LI>getWishItem - Prompts for user input and returns the entered text, if any,
-  to the calling program. Handles I/O Exceptions and insists that some text
+  <LI><code>getWishItem</code> - Prompts for user input and returns the entered text, if any,
+  to the calling program. Handles I/O exceptions and insists that some text
   is entered.
-  <LI>wwdChk4Table - Checks if the table needed by the program already exists
+  <LI><code>wwdChk4Table</code> - Checks if the table needed by the program already exists
   and is defined properly. Handles certain errors that could occur.
-  <LI>main - Allows standalone testing of the getWishItem method.
+  <LI><code>main</code> - Allows standalone testing of the
+  <code>getWishItem</code> method.
 </OL></LI>
 </UL>
 



Mime
View raw message