Return-Path:
* 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 @@
This program:
* 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.
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 @@
The Network Server jar file. It must be in your CLASSPATH to use any of the Derby Network
Server functions.
This jar file must be in your CLASSPATH to use the Derby Client Network JDBC Driver.
This jar file must be in your CLASSPATH to use the
-DB2 JDBC Universal Driver.
This jar file is the license file for the Universal
-Driver.
The Derby database engine jar file.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.java org.apache.derby.tools.sysinfo
This command will show the Derby jar files that are in the CLASSPATH along with their respective versions.
%DERBY_INSTALL%\demo\programs\ directory:
java nserverdemo.NsSample [driverType]
@@ -118,7 +112,6 @@
-
This jar file must be in your CLASSPATH to use t
he Derby Client Network JDBC Driver.
This jar file must be in your CLASSPATH to use the DB2 JDBC Universal Driver.
This jar file is the license file for the Universal Driver for Derby.
%DERBY_INSTALL%\demo\programs\nserverdemo\ directory:
@@ -179,7 +177,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.
- * @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 @@
- -- 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): -
-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
-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). -
-- 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 --
Last updated for Apache Derby Version 10.3.2