The client applications can either be on
different physical systems from the server, or they can be on the
same physical system. This is one way to achieve multiple simultaneous
access to the same InstantDB database.
Note that RMI (Java™ Remote Method
Invocation) is only available from JDK 1.1 onwards. Development
environments which do not fully support RMI will be unable to utilise
the driver.
The archive unpacks to a single JAR file:
RmiJdbc.jar. Add this jar file to your CLASSPATH. (If you want to
see the source code then you can unpack the jar using the JDK 1.1
command line tool: jar xvf RmiJdbc.jar)
Make sure that your system has TCP installed.
In what follows we'll assume that we're testing out on a machine
with a loopback driver installed. Otherwise you'll have to make
appropriate changes to the instructions for separate client and
server installations.
If you haven't already run the InstantDB
sample program then do so now (see downloads
for details). This will generate a small database that you will
be able to access via the RMI driver. When the sample program has
finished, stay in the Examples directory and type:
java -nojit RmiJdbc.RJJdbcServer jdbc.idbDriver
Note that, if you are using JDK 1.2 or later
then the "-nojit" is illegal and can safely be ommitted. The equivalent
1.2 option is "-Djava.compiler=NONE" if you still wish to disable
the Just In Time compiler. You may also experience security related
problems in JDK 1.2. These can be overcome by installing the RmiJdbc
driver and InstantDB as Java™ extensions. To do this, move
the RmiJdbc.jar file and the InstantDB jar files in the /Classes
directory, to the /jre/lib/ext directory in your JDK 1.2 installation
directory tree. Alternatively, you can modify the default security
policy by editing /jre/lib/security/java.policy.
This will start the RmiJdbc remote server.
If you're using NT/95/98 then this will take up a command line session.
If all goes well you'll see the following:
jdbc.idbDriver registered in DriverManager
Binding RmiJdbcServer...
RmiJdbcServer bound in rmi registry
The driver is now ready to accept remote
database requests. From a command prompt, enter the commands:
cd <wherever RmiJdbc.jar is>
jar -xf RmiJdbc.jar TestClient.java
javac TestClient.java
java -nojit TestClient
You should see the RmiJdbc.RJJdbcServer come
to life by invoking InstantDB and running the SQL request from issued
by TestClient. Unpacking the jar file and examining TextClient.java
should make it pretty obvious how to go about writing your own client
programs.
|