Establishing a Connection
Creating a JDBC Data Source
You can create a JDBC data source to connect from your Java application. Creating a JDBC data source based on the CData JDBC Driver for Airtable consists of three basic steps:
- Add the driver JAR file to the classpath. The JAR file is located in the lib subfolder of the installation directory. Note that the .lic file must be located in the same folder as the JAR file.
- Provide the driver class. For example:
- Provide the JDBC URL. For example:
jdbc:airtable:APIKey=keymz3adb53RqsU;BaseId=appxxN2fe34r3rjdG7;TableNames=TableA,TableB,TableC;ViewNames=TableA.ViewA,TableA.ViewB,..,TableX.ViewY; or jdbc:cdata:airtable:APIKey=keymz3adb53RqsU;BaseId=appxxN2fe34r3rjdG7;TableNames=TableA,TableB,TableC;ViewNames=TableA.ViewA,TableA.ViewB,..,TableX.ViewY;
The second format above can be used whenever there is a conflict in your application between drivers using the same URL format to ensure you are using the CData driver. The URL must start with either "jdbc:airtable:" or "jdbc:cdata:airtable:" and can include any of the connection properties in name-value pairs separated with semicolons.
Connecting to Airtable
The Airtable data source only supports the simple token-based authentication method.
To establish a connection begin by locating your ApiKey. You can find this by logging into your Airtable account and navigating to the API section. Then, click Generate API key.
From the same API section, identify your BaseId. Click on Airtable API, or navigate to https://airtable.com/api and select a base.
Supply the following to connect to data:
- ApiKey: Set this to your API key noted earlier.
- BaseId: Set this to your Base Id noted earlier. In the introduction section you can find "The ID of this base is appxxN2ftedc0nEG7."
- TableNames: A comma separated list of table names for the selected base. These are the same names of tables as found in the UI.
You may also optionally specify the following to further refine data access:
- ViewNames: A comma separated list of views in the format TableA.ViewA,TableA.ViewB,..etc. These are the same names of the views as found in the UI.
Important note : '.' character is not suggested to be used for column names since it is used for bulding column names based on paths and may risk breaking INSERT/UPDATE statements. If you already have column names that contain '.' character, please set PathDelimiter connection property to a character that is not used in column names. PathDelimiter is equal to '.' by default.
- PathDelimiter: The character which will be used as delimiter for bulding column names based on paths.