Establishing a Connection
Creating a JDBC Data Source
You can create a JDBC data source to connect from your Java application, based on CData JDBC Driver for REST.Follow these steps:
- Add the driver JAR file to the classpath. The JAR file is located in the installation directory's lib subfolder. Ensure that the .lic file is located in the same folder as the JAR file.
- Provide the driver class. For example:
cdata.jdbc.rest.RESTDriver
- Provide the JDBC URL. For example:
jdbc:rest:DataModel=Relational;URI=C:\people.xml;Format=XML
Or, if there is a conflict in your application between drivers using the same URL format, use this form to ensure that you are using the CData driver:
jdbc:cdata:rest:DataModel=Relational;URI=C:\people.xml;Format=XML
Ensure that the URL starts with either jdbc:rest: or jdbc:cdata:rest:. The URL can include any of the connection properties in name-value pairs separated with semicolons.
Modeling XML/JSON/CSV Data
The DataModel property controls how your data is represented into tables.
- Document (default): Model a top-level, document view of your REST data. The driver returns nested object arrays as aggregated XML/JSON/CSV objects.
- FlattenedDocuments: Implicitly join nested array objects and parent objects into a single table.
- Relational: View nested object arrays as individual, related tables containing a primary key and a foreign key that links to the parent document.
Set Format to XML, JSON, or CSV in accordance with the data structuring standard used by the REST source you want to connect to. and set DataModel to more closely match the data representation to the structure of your data.
Authenticating a Connection
See AuthScheme for information on the different methods of authentication.
Next Steps
- See Modeling REST Data for information on customizing schema discovery and executing SQL to REST.
- See Fine-Tuning Data Access for more advanced connection settings: fine-tune the default data modeling settings, connect through a firewall, or troubleshoot connections.