Java Reference
In-Depth Information
server will be running. After you've made those changes, all you need to do is to
increase the version of your bundle and package it up again.
Listing 10.6
Exposing your remote service
<bean id="derbyDataSource"
class="org.apache.derby.jdbc.ClientDataSource">
<property name="createDatabase" value="create"/>
<property name="databaseName" value="fancyfoodsDB"/>
<property name="portNumber" value="1527"/>
<property name="serverName" value="localhost"/>
</bean>
Network Derby driver
No longer an in-
memory database
Remote Derby
location
<bean id="derbyXADataSource"
class="org.apache.derby.jdbc.ClientXADataSource">
<property name="databaseName" value="fancyfoodsDB" />
<property name="createDatabase" value="create" />
<property name="serverName" value="localhost"/>
<property name="portNumber" value="1527"/>
</bean>
STARTING YOUR DERBY SERVER
It's easy to get your Derby server running. First you need to download a copy of
Derby, because the one in your basic runtime doesn't have any network Derby
support. Copies of Derby can be obtained from http://db.apache.org/derby/
derby_downloads.html .
When you have a copy of Derby, you need to start the server running. This can be
done by unzipping the Derby zip and issuing a single command from the Derby lib
directory:
java -jar derbyrun.jar server start
Now that your Derby instance is running, you need to alter your basic runtime to sup-
port remote client connections to Derby. To do this, you need to replace the existing
Derby JAR , which will be called something like derby_10.5.3.0_1.jar , with the der-
byclient.jar from the Derby you downloaded. To get this bundle picked up in your
basic runtime, you'll also have to edit the configuration for your framework. This con-
figuration file is called configuration/config.ini.
WARNING: DERBY'S SPLIT PACKAGE The version of Derby in your basic frame-
work only provides support for embedded databases. As a result, it doesn't
include the remote client drivers. Unfortunately, the remote client drivers and
embedded drivers are in the same package. This means that you don't get a
resolve-time error about the missing class. If you don't update your basic frame-
work to replace the embedded Derby package, then you'll see a ClassNotFound-
Exception from the Blueprint container trying to create your datasource.
After you replace the Derby bundle with the remote client, you may find that
you start seeing a ClassNotFoundException from another datasource bundle.
You aren't using this bundle, so it's nothing to worry about. You can remove the
bundle from your basic runtime if the exception makes things difficult to follow.
 
 
Search WWH ::




Custom Search