Distributed Applications

In a distributed application, parts of the application logic run on one machine, and parts run on another machine. With Sybase IQ, you can create distributed Java applications, where part of the logic runs in the database server, and part on the client machine.

Sybase IQ is capable of exchanging Java objects with an external, Java client.

Having the client application retrieve a Java object from a database is the key task in a distributed application This section describes how to accomplish that task.

Features of Distributed Applications

There are two other methods in JDBCExamples.java that use distributed computing:

  • serializeVariable—This method creates a native Java object referenced by a SQL variable on the database server and passes it back to the client application.

  • serializeColumnCastClass—This method is like the serializeColumn method, but demonstrates how to reconstruct subclasses. The column that is queried (JProd from the product table) is of data type asademo.Product. Some of the rows are asademo.Hat, which is a subclass of the Product class. The proper class is reconstructed on the client side.

Requirements for Distributed Applications

There are two tasks in building a distributed application.

  • Any class running in the server must implement the Serializable interface. This is very simple.

  • The client-side application must import the class, so the object can be reconstructed on the client side.

These tasks are described in the following sections.

Related concepts
Insert and Retrieve Objects
Queries Using JDBC