Java Reference
In-Depth Information
In one command window, set DERBY_HOME . Start the network server via the
startNetworkServer script (located in %JAVA_HOME%\db \ bin ), which takes
care of setting the classpath. You should see output similar to this:
Mon Sep 19 21:23:14 CDT 2011 : Security manager installed
using the Basic server
security
policy.
Mon Sep 19 21:23:16 CDT 2011 : Apache Derby Network Server
- 10.8.1.2 - (1095077) started
and ready to accept connections on port 1527
In the other command window, set DERBY_HOME followed by CLASSPATH (via
setNetworkClientCP ). Assuming that simple is the current directory, invoke
java SimpleApp derbyClient torunthisapplication.Thistime,youshouldob-
serve the following output:
SimpleApp starting in derbyclient 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
Noticethatthedatabaseengineisnotshutdownintheclient/serverenvironment.Al-
though not indicated in the output, there's a second difference between running Sim-
pleApp in the embedded and client/server environments. In the embedded environ-
ment,the derbyDB databasedirectoryiscreatedinthe simple directory.Intheclient/
server environment, this database directory is created in the directory that was current
when you executed startNetworkServer .
Whenyou'refinishedplayingwith SimpleApp intheclient/serverenvironment,you
shouldshutdownthenetworkserveranddatabaseengine.Accomplishthistaskbyin-
vokingthe stopNetworkServer script(locatedin %JAVA_HOME%\db \ bin ).You
can also shut down (or start and otherwise control) the network server by running the
NetworkServerControl script(alsolocatedin %JAVA_HOME%\db \ bin ).Forex-
Search WWH ::




Custom Search