Relational Junction XML JDBC Driver RMI

Using the driver as a client/server via RMI

You can use the driver as a client/server (JDBC type 3) through the RMI (remote method invocation) technology. One of possible solutions to implement that is using a RMI-JDBC bridge (

Advantages of using an RMI server:

1) It is a platform-independent multithreading server. You can run it on any OS supporting Java.
2) It can be used as an alternative to FTP (SFTP, HTTP, etc) protocols for accessing remote files. Besides an RMI server has performance higher than mentioned protocols, because it does not require synchronizing files between the driver cache and a remote FTP (SFTP, HTTP, etc) server, especially while updating data.
3) The driver .jar files are stored only at a server. So if you want to update the driver, you just need to update the driver at the server, but not for each client computer.
4) It supports the secure channel via SSL and RMI Security Manager.

Starting server:

1. Download the RmiJdbc project files at
2. Copy RmiJdbc.jar and the XML driver .jars to some directory at a server machine, e.g.: c:/rmiserver
3. Suppose we have our XML files at c:/rmiserver/xmlfiles
4. Start the RMI server using the command

java -classpath "RmiJdbc.jar;xmldriver.jar;log4j.jar;xom.jar;nux.jar;saxon8.jar;saxon8-xpath.jar" org.objectweb.rmijdbc.RJJdbcServer com.relationaljunction.jdbc.xml.XMLDriver2

5. After executing the command the RMI server starts, listens 1099 port by default and registers the driver class. SSL and RMI security manager by default are not used. For more details about command-line parameters supported by an RMI server see

Starting client:

1. Copy RmiJdbc.jar to your client machine as well.
2. Compile the example below
3. Run the example (note that XML .jar files are not required at the client side).

java -classpath ".;RmiJdbc.jar" RMIClient
public class RMIClient {
public static void main(String[] args) {
try {
// Register RmiJdbc Driver in jdbc DriverManager
// On some platforms with some java VMs, newInstance() is necessary...
// our JDBC url that will be used at the server machine.
// The property 'singletonConnection = true' is recommended.
String url = "jdbc:relationaljunction:xml:xmlfiles/schema.xml?singletonConnection=true";
// in this example an RMI host will point to local host
String rmiHost = "//" +;
// RmiJdbc URL is of the form:
// jdbc:rmi://<rmiHostName[:port]>/
java.sql.Connection c = java.sql.DriverManager.getConnection("jdbc:rmi:" + rmiHost + "/" + url);
// these Connection, Statement and ResultSet objects are remote!
// All is occurring at the server side!
java.sql.Statement st = c.createStatement();
java.sql.ResultSet rs = st.executeQuery("SELECT * FROM employees");
java.sql.ResultSetMetaData md = rs.getMetaData();
while ( {
for (int i = 1; i <= md.getColumnCount(); i++) {
System.out.print(rs.getString(i) + "t");
} catch (Exception e) {