All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JBMSTours.vti.jdbc1_2.ExternalCloudscapeTable

java.lang.Object
   |
   +----COM.cloudscape.vti.UpdatableVTITemplate
           |
           +----JBMSTours.vti.jdbc1_2.ExternalCloudscapeTable

public class ExternalCloudscapeTable
extends UpdatableVTITemplate
A read-write VTI class; instantiating this VTI within an SQL-J statement gives access to a table in an external Cloudscape database. This class automatically loads the embedded URL; use the embedded form of the database connection URL as the first argument.

Here is an example SQL-J statement using this VTI class as an ExternalVirtualTable:

INSERT INTO NEW JBMSTours.vti.jdbc1_2.ExternalCloudscapeTable( 'jdbc:cloudscape:history', 'HotelBookings') SELECT * FROM HotelBookings

NOTE: There is no need to define the getResultSetConcurrency method in this class, since the implementation in UpdatableVTITemplate already returns ResultSet.CONCUR_UPDATABLE.

In client/server environments: In some cases, even statements running in a client connection should use the embedded form of the URL because the VTI is instantiated within the cloudscape engine; if the database is accessible to the server in which Cloudscape is running, Cloudscape uses the embedded URL to access the external database.

If the database is running on an external server somewhere, use the client form of the URL as the first argument. However, this class does not automatically load the driver. You will have to load the client driver. in an SQL-J statement before instantiating the VTI. For example, for RmiJdbc, you could load the driver like this:

Values (CLASS java.lang.Class).forName('COM.cloudscape.core.RmiJdbcDriver')

Then, when instantiating the VTI, you would use a client form of the database connection URL:

INSERT INTO NEW  JBMSTours.vti.jdbc1_2.ExternalCloudscapeTable(
     'jdbc:cloudscape:rmi://localhost:1088/toursDB', 'HotelBookings')
     SELECT * FROM HotelBookings;
 


Constructor Index

 o ExternalCloudscapeTable(String, String)
Construct the read-write VTI class.

Method Index

 o close()
Close this class.
 o executeQuery()
Provide the ResultSet for the external Table.
 o getMetaData()
Provide the metadata for the query.

Constructors

 o ExternalCloudscapeTable
 public ExternalCloudscapeTable(String url,
                                String tableName)
Construct the read-write VTI class.

Parameters:
url - URL to the external Cloudscape database.
tableName - Name of the table in that Cloudscape database.

Methods

 o executeQuery
 public ResultSet executeQuery() throws SQLException
Provide the ResultSet for the external Table. In this case, instantiate an ECTResult.

Returns:
the result set for the query
Throws: SQLException
on unexpected JDBC error
Overrides:
executeQuery in class UpdatableVTITemplate
See Also:
ECTResult
 o getMetaData
 public ResultSetMetaData getMetaData() throws SQLException
Provide the metadata for the query.

Returns:
the result set metadata for the query
Throws: SQLException
thrown by JDBC calls
Overrides:
getMetaData in class UpdatableVTITemplate
 o close
 public void close() throws SQLException
Close this class. Called by Cloudscape only at the end compiling a select.

Throws: SQLException
on unexpected JDBC error
Overrides:
close in class UpdatableVTITemplate
See Also:
Statement

All Packages  Class Hierarchy  This Package  Previous  Next  Index