Database System Plugins
In this document, we show how to build custom connectors to any relational/non-relational database management system. These connectors interface Sclera with an arbitrary database system, relational or non-relational, providing access to the underlying data, and also enable Sclera to push down computations in relevant parts user queries and commands on the interfaced database system.
Sclera - Oracle Connector, Sclera - MySQL Connector, and Sclera - PostgreSQL Connector are built using this SDK. For examples of how these connectors are used in Sclera, please refer to the documentation on connecting Sclera to database systems.
Building Database System Connectors◄
To build a custom datasource connector, you need to provide implementations of the following abstract classes in the SDK:
- Provides the database system as a service to Sclera.
- Contains an
idthat identifies this service.
- Contains a method
createLocationthat is used to create a new location instance for this service.
- Represents the underlying database system.
- Provides the configuration parameters, and properties (e.g. temporary or persistent, read-only or read-write, etc.).
- Provides the driver for interfacing with the underlying system.
- Executes the statements provided by Sclera on the underlying database system, and passes back the results.
- Provides the metadata driver for accessing the metadata for the data stored in the underlying database system.
- Provides the metadata for the data stored in the underlying database system.
Special case: Relational Databases◄
If the underlying system is a relational database system, which talks SQL and uses JDBC as the interface, Sclera does most of the work. For such systems, you need to provide implementations of the following:
- Provides the relational database system as a service to Sclera.
- Represents the underlying relational database system.
- Provides a standard implementation of
StatementMetadataDriver, based on JDBC. You only need to configure the JDBC configuration parameters (e.g. the JDBC URL) for the underlying system, and additional location properties (e.g. temporary or persistent, read-only or read-write, etc.).
- Provides the SQL mapper for translating Sclera's internal SQL representation to the SQL for the underlying system.
- Translates Sclera's internal SQL representation to the SQL for the underlying system. This is needed because the SQL clauses and constructs across different systems vary significantly and sometimes do not follow the standard.
The Sclera - MySQL Connector, included with the Sclera platform, is open source and implements the relational database interface mentioned above.
Packaging and Deploying the Connector◄
The implementation has a dependency on:
- the database system's driver (e.g. the appropriate JDBC driver for relational database systems).
"sclera-config"core components. Note that these dependencies is annotated
"provided"since these libraries will already be available in the
CLASSPATHwhen this connector is run with Sclera.
- (optional) the test framework
scalatestfor running the tests.
These are specified in the build file. As an example, see the Sclera - MySQL Connector's build file.
Follow steps similar to those described here.
Note: Please ensure that the identifier you assign to the connector is unique, that is - does not conflict with the identifier of any other available