Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 58067 invoked from network); 24 Jun 2009 20:02:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jun 2009 20:02:10 -0000 Received: (qmail 47291 invoked by uid 500); 24 Jun 2009 20:02:21 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 47251 invoked by uid 500); 24 Jun 2009 20:02:21 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 47242 invoked by uid 99); 24 Jun 2009 20:02:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2009 20:02:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jun 2009 20:02:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C1BF82388877; Wed, 24 Jun 2009 20:01:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r788163 - in /db/derby/code/branches/10.5/java/demo: nserverdemo/NsSample.java nserverdemo/SimpleNetworkClientSample.java nserverdemo/nserverdemo.html nserverdemo/simpleserversample.html simple/SimpleApp.java simple/example.html Date: Wed, 24 Jun 2009 20:01:55 -0000 To: derby-commits@db.apache.org From: kmarsden@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090624200155.C1BF82388877@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kmarsden Date: Wed Jun 24 20:01:55 2009 New Revision: 788163 URL: http://svn.apache.org/viewvc?rev=788163&view=rev Log: DERBY-4276 Update demo's to remove references to com.ibm.db2.jcc.DB2Driver Contributed by Lily Wei (lilywei at yahoo dot com) Modified: db/derby/code/branches/10.5/java/demo/nserverdemo/NsSample.java db/derby/code/branches/10.5/java/demo/nserverdemo/SimpleNetworkClientSample.java db/derby/code/branches/10.5/java/demo/nserverdemo/nserverdemo.html db/derby/code/branches/10.5/java/demo/nserverdemo/simpleserversample.html db/derby/code/branches/10.5/java/demo/simple/SimpleApp.java db/derby/code/branches/10.5/java/demo/simple/example.html Modified: db/derby/code/branches/10.5/java/demo/nserverdemo/NsSample.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/demo/nserverdemo/NsSample.java?rev=788163&r1=788162&r2=788163&view=diff ============================================================================== --- db/derby/code/branches/10.5/java/demo/nserverdemo/NsSample.java (original) +++ db/derby/code/branches/10.5/java/demo/nserverdemo/NsSample.java Wed Jun 24 20:01:55 2009 @@ -41,8 +41,7 @@ The program: 1. starts the Derby Network Server - 2. loads the IBM DB2 JDBC Universal driver or derby client JDBC driver - (default is the derby client JDBC driver) + 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. @@ -66,8 +65,7 @@ public class NsSample { - public static final String DB2_JDBC_UNIVERSAL_DRIVER = new String("com.ibm.db2.jcc.DB2Driver"); - public static final String DERBY_CLIENT_DRIVER = "org.apache.derby.jdbc.ClientDriver"; + public static final String DERBY_CLIENT_DRIVER = "org.apache.derby.jdbc.ClientDriver"; public static int NUM_ROWS = 50; /* Number of rows to load initially */ public static int ITERATIONS = 10; //Each client does these many iterations public static int NUM_CLIENT_THREADS = 2; @@ -82,7 +80,6 @@ // To connect to Derby Network Server // This URL describes the target database for type 4 connectivity // Notice that the properties may be established via the URL syntax - private static final String CS_NS_DBURL= "jdbc:derby:net://localhost:"+NETWORKSERVER_PORT+"/NSSampledb;create=true;retrieveMessagesFromServerOnGetMessage=true;deferPrepares=true;"; // URL for the Derby client JDBC driver. private static final String DERBY_CLIENT_URL= "jdbc:derby://localhost:"+NETWORKSERVER_PORT+"/NSSampledb;create=true;"; @@ -105,9 +102,6 @@ try { - // Determine which JDBC driver we are using with Derby - parseArguments(args); - pw = new PrintWriter(System.out,true); // to print messages pw.println("Using JDBC driver: " + jdbcDriver); @@ -170,8 +164,8 @@ Properties properties = new java.util.Properties(); // The user and password properties are a must, required by JCC - properties.setProperty("user","cloud"); - properties.setProperty("password","scape"); + properties.setProperty("user","derbyuser"); + properties.setProperty("password","pass"); // Get database connection via DriverManager api try { @@ -231,33 +225,5 @@ } } - /** - * Determine which jdbc driver to use by parsing the command line args. - * Accepted values: - * jccjdbclient - The DB2 type 4 universal driver - * derbyclient - The Derby network driver (default). - * Note: because this is just a sample, we only care about whether - * the above values are specified. If they are not, then we default - * to the Derby network driver. - */ - private void parseArguments(String[] args) - { - int length = args.length; - - for (int index = 0; index < length; index++) - { - if (args[index].equalsIgnoreCase("jccjdbcclient")) - { - jdbcDriver = DB2_JDBC_UNIVERSAL_DRIVER; - url = CS_NS_DBURL; - break; - } else if (args[index].equalsIgnoreCase("derbyClient")) - { - jdbcDriver = DERBY_CLIENT_DRIVER; - url = DERBY_CLIENT_URL; - break; - } - } - } } Modified: db/derby/code/branches/10.5/java/demo/nserverdemo/SimpleNetworkClientSample.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/demo/nserverdemo/SimpleNetworkClientSample.java?rev=788163&r1=788162&r2=788163&view=diff ============================================================================== --- db/derby/code/branches/10.5/java/demo/nserverdemo/SimpleNetworkClientSample.java (original) +++ db/derby/code/branches/10.5/java/demo/nserverdemo/SimpleNetworkClientSample.java Wed Jun 24 20:01:55 2009 @@ -36,14 +36,14 @@ * and interact with Derby Network Server * * In particular,this sample program - * 1) loads the DB2 Universal JDBC Driver or the Derby Network Client driver + * 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 * and then exits the program * - * Before running this program, please make sure that Clouscape Network Server is up + * Before running this program, please make sure that Derby Network Server is up * and running. *

* Usage: java SimpleNetworkClientSample @@ -63,11 +63,7 @@ */ private static int NETWORKSERVER_PORT=1527; - /** - * DB2 JDBC UNIVERSAL DRIVER class names - */ - private static final String DB2_JDBC_UNIVERSAL_DRIVER = "com.ibm.db2.jcc.DB2Driver"; - private static final String DB2_JCC_DS = "com.ibm.db2.jcc.DB2SimpleDataSource"; + /** * Derby Network Client Driver class names */ @@ -77,7 +73,6 @@ /** * This URL is used to connect to Derby Network Server using the DriverManager. - * This URL is for the DB2 JDBC Universal Driver * Notice that the properties may be established via the URL syntax */ private static final String CS_NS_DBURL= "jdbc:derby:net://localhost:"+NETWORKSERVER_PORT+"/"+DBNAME+";retrieveMessagesFromServerOnGetMessage=true;deferPrepares=true;"; @@ -106,8 +101,6 @@ try { System.out.println("Starting Sample client program "); - // Determine which JDBC driver to use - parseArguments(args); // load the appropriate JDBC Driver loadDriver(); @@ -205,15 +198,6 @@ args = new Object[] {new Integer(1527)}; portnumber.invoke(ds, args); - // The following is only applicable to the DB2 JDBC driver - if(jdbcDataSource.equals( DB2_JCC_DS)) - { - // driver type must be 4 to access Derby Network Server - Method drivertype = nsDataSource.getMethod("setDriverType", methodParams); - args = new Object[] {new Integer(4)}; - drivertype.invoke(ds, args); - } - return ds; } @@ -243,8 +227,8 @@ Properties properties = new java.util.Properties(); // The user and password properties are a must, required by JCC - properties.setProperty("user","cloud"); - properties.setProperty("password","scape"); + properties.setProperty("user","derbyuser"); + properties.setProperty("password","pass"); // Get database connection via DriverManager api Connection conn = DriverManager.getConnection(url,properties); @@ -286,37 +270,6 @@ stmt.close(); } } - /** - * Determine which jdbc driver to use by parsing the command line args. - * Accepted values: - * jccjdbclient - The DB2 type 4 universal driver - * derbyclient - The Derby network driver (default). - * Note: because this is just a sample, we only care about whether - * the above values are specified. If they are not, then we default - * to the Derby network driver. - */ - private void parseArguments(String[] args) - { - int length = args.length; - - for (int index = 0; index < length; index++) - { - if (args[index].equalsIgnoreCase("jccjdbcclient")) - { - - jdbcDriver = DB2_JDBC_UNIVERSAL_DRIVER; - jdbcDataSource = DB2_JCC_DS; - url = CS_NS_DBURL; - break; - } else if (args[index].equalsIgnoreCase("derbyClient")) - { - jdbcDriver = DERBY_CLIENT_DRIVER; - jdbcDataSource = DERBY_CLIENT_DS; - url = DERBY_CLIENT_URL; - break; - } - } - } } Modified: db/derby/code/branches/10.5/java/demo/nserverdemo/nserverdemo.html URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/demo/nserverdemo/nserverdemo.html?rev=788163&r1=788162&r2=788163&view=diff ============================================================================== --- db/derby/code/branches/10.5/java/demo/nserverdemo/nserverdemo.html (original) +++ db/derby/code/branches/10.5/java/demo/nserverdemo/nserverdemo.html Wed Jun 24 20:01:55 2009 @@ -28,7 +28,7 @@

  • starts the Derby Network Server
  • checks if the Derby Network Server is running -
  • loads the DB2 JDBC Universal Driver or the Derby Client Network JDBC Driver +
  • loads the Derby Client Network JDBC Driver
  • creates the database 'NsSampledb' if not already created
  • checks to see if the schema is already created, and if not, creates the schema which includes the SAMPLETBL table and corresponding @@ -83,7 +83,6 @@
    • NsSample.class
    • NsSampleClientThread.class
    • -
    • NsSampleWork.class
    • NetworkServerUtil.class
  • @@ -97,20 +96,15 @@ class=italic>%DERBY_INSTALL%\demo\programs\ directory, where %DERBY_INSTALL% is the directory where you installed Derby.
  • Set the CLASSPATH to the current directory (".") and also include the following - jar files in order to use the Derby Network Server and the DB2 JDBC Universal Driver or the Derby Client Network JDBC Driver. + jar files in order to use the Derby Network Server and the Derby Client Network JDBC Driver.
    • derbynet.jar
      The Network Server jar file. It must be in your CLASSPATH to use any of the Derby Network Server functions.
    • derbyclient.jar
      This jar file must be in your CLASSPATH to use the Derby Client Network JDBC Driver.
    • -
    • db2jcc.jar
      This jar file must be in your CLASSPATH to use the -DB2 JDBC Universal Driver.
    • -
    • db2jcc_license_c.jar
      This jar file is the license file for the Universal -Driver.
    • derby.jar
      The Derby database engine jar file.
  • -
  • Test the CLASSPATH settings by running the following java command:
    java org.apache.derby.tools.sysinfo
    This command will show the Derby jar files that are in the CLASSPATH as well as -the DB2 JDBC Universal Driver along with their respective versions.
  • +
  • Test the CLASSPATH settings by running the following java command:
    java org.apache.derby.tools.sysinfo
    This command will show the Derby jar files that are in the CLASSPATH along with their respective versions.
  • Once you have set up your environment correctly, execute the application from the
    %DERBY_INSTALL%\demo\programs\ directory:
    java nserverdemo.NsSample [driverType]
    @@ -118,7 +112,6 @@
  • Where the possible values for driverType are:
    • derbyClient (default) -
    • jccjdbcclient
Modified: db/derby/code/branches/10.5/java/demo/nserverdemo/simpleserversample.html URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/demo/nserverdemo/simpleserversample.html?rev=788163&r1=788162&r2=788163&view=diff ============================================================================== --- db/derby/code/branches/10.5/java/demo/nserverdemo/simpleserversample.html (original) +++ db/derby/code/branches/10.5/java/demo/nserverdemo/simpleserversample.html Wed Jun 24 20:01:55 2009 @@ -145,7 +145,7 @@

This program:

    -
  • loads the DB2 JDBC Universal Driver or the Derby Network Client JDBC Driver
  • +
  • loads the Derby Network Client JDBC Driver
  • obtains a client connection using the Driver Manager
  • obtains a client connection using a DataSource
  • tests the database connections by executing a sample query
  • @@ -169,8 +169,6 @@
  • the current directory (".")
  • derbyclient.jar
    This jar file must be in your CLASSPATH to use t he Derby Client Network JDBC Driver.
  • -
  • db2jcc.jar
    This jar file must be in your CLASSPATH to use the DB2 JDBC Universal Driver.
  • -
  • db2jcc_license_c.jar
    This jar file is the license file for the Universal Driver for Derby.
  • Once you have set up your environment correctly, execute the application from the
    %DERBY_INSTALL%\demo\programs\nserverdemo\ directory: @@ -179,7 +177,6 @@
  • Where the possible values for driverType are:
    • derbyClient (default) -
    • jccjdbcclient
  • Modified: db/derby/code/branches/10.5/java/demo/simple/SimpleApp.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/demo/simple/SimpleApp.java?rev=788163&r1=788162&r2=788163&view=diff ============================================================================== --- db/derby/code/branches/10.5/java/demo/simple/SimpleApp.java (original) +++ db/derby/code/branches/10.5/java/demo/simple/SimpleApp.java Wed Jun 24 20:01:55 2009 @@ -72,9 +72,6 @@ *
  • derbyclient - will use the Derby client driver to * access the Derby Network Server. This driver is included in the * derbyclient.jar file.
  • - *
  • jccjdbcclient - will use the DB2 Universal JDBC - * network client driver, also known as JCC, to access the Network - * Server. This driver is not part of the Derby distribution.
  • * *

    * When you are using a client/server framework, the network server must @@ -101,14 +98,14 @@ *

    * Starts the actual demo activities. This includes loading the correct * JDBC driver, creating a database by making a connection to Derby, - * creating a table in the database, and inserting, updating and retreiving - * some data. Some of the retreived data is then verified (compared) against + * 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 * framework is used, the database is shut down.

    *

    * Generally, when using a client/server framework, other clients may be * (or want to be) connected to the database, so you should be careful about - * doing shutdown unless you know that noone else needs to access the + * doing shutdown unless you know that no one else needs to access the * database until it is rebooted. That is why this demo will not shut down * the database unless it is running Derby embedded.

    * @@ -254,7 +251,7 @@ * comprehend, so we use a different pattern. */ - int number; // street number retreived from the database + int number; // street number retrieved from the database boolean failure = false; if (!rs.next()) { @@ -329,7 +326,7 @@ // the shutdown=true attribute shuts down Derby DriverManager.getConnection("jdbc:derby:;shutdown=true"); - // To shut down a specific database only, but keeep the + // To shut down a specific database only, but keep the // engine running (for example for connecting to other // databases), specify a database in the connection URL: //DriverManager.getConnection("jdbc:derby:" + dbName + ";shutdown=true"); @@ -472,20 +469,13 @@ * If the argument is "embedded" or invalid, this method will not change * anything, meaning that the default values will be used.

    *

    - * @param args JDBC connection framework, either "embedded", "derbyclient" - * or "jccjdbcclient". Only the first argument will be considered, - * the rest will be ignored. + * @param args JDBC connection framework, either "embedded", "derbyclient". + * Only the first argument will be considered, the rest will be ignored. */ private void parseArguments(String[] args) { if (args.length > 0) { - if (args[0].equalsIgnoreCase("jccjdbcclient")) - { - framework = "jccjdbc"; - driver = "com.ibm.db2.jcc.DB2Driver"; - protocol = "jdbc:derby:net://localhost:1527/"; - } - else if (args[0].equalsIgnoreCase("derbyclient")) + if (args[0].equalsIgnoreCase("derbyclient")) { framework = "derbyclient"; driver = "org.apache.derby.jdbc.ClientDriver"; Modified: db/derby/code/branches/10.5/java/demo/simple/example.html URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/demo/simple/example.html?rev=788163&r1=788162&r2=788163&view=diff ============================================================================== --- db/derby/code/branches/10.5/java/demo/simple/example.html (original) +++ db/derby/code/branches/10.5/java/demo/simple/example.html Wed Jun 24 20:01:55 2009 @@ -36,7 +36,6 @@

    @@ -71,7 +70,7 @@ at a time.

    In a client/server environment, the application demonstrates the -use of the Derby network client driver or the IBM DB2 JDBC Universal Driver by +use of the Derby network client driver by connecting to the Network Server and running the demo. Note that the client drivers allow multiple instances of the application to run at the same time. However, the SQL operations performed by this demo will cause failures when @@ -349,8 +348,7 @@

    You will need to set up both the client process and the server process to run the demo application as a client connecting to the Network server. The Network Server needs to be running before you can connect using a client -driver. This demo includes support for both the Derby client driver and the IBM -DB2 Universal JDBC driver. +driver. This demo includes support for the Derby client driver.

    You must start the Network Server before trying to run the demo application in one of the client modes. @@ -516,98 +514,6 @@

    - -

    Using the IBM DB2 JDBC Universal Driver (jccjdbcclient)

    -

    - In version 10.0 of Derby, the IBM DB2 JDBC Universal Driver (also known as - JCC) was the only client driver that could communicate with the Derby Network - Server. This driver is not licensed under the - Apache License, Version 2.0 used - by Apache Derby, but can be downloaded from the IBM developerWorks website - (see: IBM - DB2 JDBC Universal Driver for Apache Derby Network Server for more - information). -

    - - - - - - - - - - - - -
    Class name:com.ibm.db2.jcc.DB2Driver
    Libraries:db2jcc.jar
    db2jcc_license_c.jar
    -

    - Newer versions of Derby include Derby's own network - client driver, which is the recommended client driver for most applications. - The DB2 Universal Driver is still supported and can be utilized with the - SimpleApp demo as follows (these instructions assume you have unzipped the - Universal Driver libraries into the lib directory of - DERBY_HOME): -

    -
      -
    1. Open a command window -
    2. If you haven't set it already on a system-wide basis, set - the DERBY_HOME environment variable to the location - of this Derby installation. This is not strictly required to run the demo, but - this environment variable will be used later on this page to refer to the - required Derby resources, files, etc. Examples: -

      UNIX (ksh/bash):

      -

      export DERBY_HOME=/home/user/derby/db-derby-10.x.y.z-bin

      -

      Windows:

      -

      set DERBY_HOME=c:\programs\derby\db-derby-10.x.y.z-bin

      -
    3. Change directories to the $DERBY_HOME/demo/programs/simple directory. -
    4. In the jcc client command window, set the CLASSPATH to include the - current directory (the location of SimpleApp.class) - and the JCC libraries (db2jcc.jar and - db2jcc_license_c.jar). - (You may skip this step and provide the classpath as an option to the JVM - launch command instead, refer to your JVM's documentation for details). -

      This may be done as follows:

      -

      UNIX (ksh/bash):

      -

      - export CLASSPATH=.:${DERBY_HOME}/lib/db2jcc.jar:${DERBY_HOME}/lib/db2jcc_license_c.jar -

      -

      WINDOWS:

      -

      - set CLASSPATH=.;%DERBY_HOME%\lib\db2jcc.jar;%DERBY_HOME%\lib\db2jcc_license_c.jar -

      -

      - It is assumed that you installed the IBM DB2 JDBC Universal Driver jars in - the lib subdirectory of this Derby installation - (DERBY_HOME). -

      -
    5. Start the Derby Network Server in a different command - window, as described here -
    6. Start the SimpleApp demo in JCC client mode: -

      - java SimpleApp jccjdbcclient -

      -

      The jccjdbcclient argument - tells the program to use the IBM DB2 JDBC Universal driver (JCC) instead - of its default driver (the embedded driver). -

      -

      A successful run produces the following output:

      -
      -SimpleApp starting in jccjdbc mode
      -Loaded the appropriate driver
      -Connected to and created database derbyDB
      -Created table location
      -Inserted 1956 Webster
      -Inserted 1910 Union
      -Updated 1956 Webster to 180 Grand
      -Updated 180 Grand to 300 Lakeshore
      -Verified the rows
      -Dropped table location
      -Committed the transaction
      -SimpleApp finished
      -    
      -
    -