Network Deployment (Distributed operating systems), v8.0 > Reference > Developer detailed usage information


JDBC mediator serialization

The DataGraph produced by the JDBC DMS can be serialized and written out to a file, or sent across a network.

The following example illustrates serialization and de-serialization of a graph:

// This example assumes the creation of the Customer
// metadata and the JDBC DMS.

DataObject object = mediator.getGraph();
DataGraph origGraph = object.getDataGraph();

FileOutputStream out = new FileOutputStream("test.datagraph");
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(origGraph);
out.close();

FileInputStream in = new FileInputStream("test.datagraph");
ObjectInputStream oin = new ObjectInputStream(in);
DataGraph graph = (DataGraph) oin.readObject();
DataObject obj = (DataObject) graph.getRootObject();

// Now, the DataObject retrieved from the input stream
// obj is equal to the original variable object put
// through the output stream.

Java DataBase Connectivity Mediator Service

+

Search Tips   |   Advanced Search