![]()
![]() ![]() ![]() ![]() ![]() ![]() ![]() Documentation Top ![]() Global Index ![]() Reference Manual ![]() ![]() ![]() Developer's Guide ![]() ![]() Tuning Cloudscape ![]() ![]() |
Getting External Data: Using the Cloudscape Virtual Table InterfaceCloudscape comes with a powerful interface to external data. Called the Virtual Table Interface, or VTI, it provides a way for you to access data from some external data source within an SQL-J statement as if it were a real table. To access the data, you first must create a Java class that fulfills the VTI requirements (see Requirements and Options for VTI Classes). To summarize, the class must implement the java.sql.ResultSet interface. The idea is that when you construct a new instance of your class, given some parameter or parameters, the instance of the class accesses some kind of external data. For example, it could call a routine to access another vendors database, it could open some Web pages, or it could open some kind of proprietary files. After accessing the data, it instantiates the data in such a way as to make it look like a ResultSet, and it provides the appropriate ResultSetMetaData that tells Cloudscape what the data looks like. Within the SQL-J language, you do not need to declare a VTI or create it as a database object. Instead, you construct a VTI on the fly in a FROM clause using the NEW keyword, providing any parameters, and providing a correlation name for the virtual table. For example, the class COM.cloudscape.tools.FileImport is a class provided by Cloudscape for an import/export utility that fulfills the VTI requirements. (Cloudscape has also provided a built-in class alias for this class). Within an SQL-J statement, you use the NEW keyword to create a virtual table from data in a flat file (from which you can SELECT).
You can write your own classes to access any kind of external data, such as news feeds, data from other database vendors, etc. See Programming VTIs for more information. | ||
![]() ![]() ![]() ![]() ![]() ![]() | ![]() ![]() Cloudscape Version 3.0 ![]() For technical support, go to: www.cloudscape.com and click Support. Copyright © 1998 and 1999 Cloudscape, Inc. All rights reserved. |