Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Bidirectional Access to Bitbucket Data from FileMaker Pro
Use the MySQL Remoting feature of the JDBC driver to integrate Bitbucket data in Filemaker Pro for Mac or Windows.
This article shows how to use the CData JDBC Driver for Bitbucket to integrate with the External SQL Sources (ESS) feature in FileMaker Pro, which allows you to link records in FileMaker Pro with related records in your other operational data stores.
You will use the MySQL Remoting feature to access Bitbucket as a remote MySQL database. The CData JDBC Driver for Bitbucket implements both the JDBC and MySQL standards to integrate with applications like FileMaker Pro that support connections to traditional databases like MySQL but not generic JDBC connections.
Selecting a FileMaker Pro Integration
There are two data access modes in FileMaker Pro:
- Data Import: Bitbucket data is copied into a FileMaker Pro database and can be refreshed on demand. To streamline this solution, use the CData ODBC driver, as FileMaker Pro supports ODBC natively, but it does not support JDBC. To use this approach, see ODBC Bitbucket Integration in FileMaker Pro.
- ESS: Instead of working with a local copy of the data, you can use the JDBC driver to create an external SQL source. The remote data can be modified in FileMaker Pro and tables can be used in the relationships graph like standard FileMaker Pro tables.
Outlining the ESS Setup
The JDBC driver is part of a data access chain. Compared to a native ODBC integration, FileMaker Pro integrations that use MySQL remoting have several additional components. This article shows how to link each of the following components with FileMaker Pro:
- The CData JDBC driver.
- The CData MySQL Remoting daemon (included with the driver).
- An ODBC driver for MySQL.
On Windows, FileMaker Pro requires the official MySQL driver, the MySQL Connector\ODBC (currently, the best option is Connector\ODBC 8.0.11).
On macOS, FileMaker Pro requires the Actual Technologies Open Databases ODBC driver.
An ODBC driver manager.
On Windows, the driver manager is built in. On macOS, you will need to install a driver manager before installing the ODBC driver; install the iODBC driver manager.
Start the Remoting Daemon
Follow the steps below to enable the MySQL Remoting feature:
-
Open Terminal and change to the lib subfolder in the installation folder.
$ cd "/Applications/CData/CData JDBC Driver for Bitbucket/lib"
- Edit the configuration file (cdata.jdbc.bitbucket.remoting.ini by default):
- Update the [databases] section with the JDBC Connection URL for Bitbucket:
bitbucket = "Workspace=myworkspaceslug;Schema=InformationInitiateOAuth=GETANDREFRESH"
For most queries, you must set the Workspace. The only exception to this is the Workspaces table, which does not require this property to be set, as querying it provides a list of workspace slugs that can be used to set Workspace. To query this table, you must set Schema to 'Information' and execute the query SELECT * FROM Workspaces>.
Setting Schema to 'Information' displays general information. To connect to Bitbucket, set these parameters:
- Schema: To show general information about a workspace, such as its users, repositories, and projects, set this to Information. Otherwise, set this to the schema of the repository or project you are querying. To get a full set of available schemas, query the sys_schemas table.
- Workspace: Required if you are not querying the Workspaces table. This property is not required for querying the Workspaces table, as that query only returns a list of workspace slugs that can be used to set Workspace.
Authenticating to Bitbucket
Bitbucket supports OAuth authentication only. To enable this authentication from all OAuth flows, you must create a custom OAuth application, and set AuthScheme to OAuth.
Be sure to review the Help documentation for the required connection properties for you specific authentication needs (desktop applications, web applications, and headless machines).
Creating a custom OAuth application
From your Bitbucket account:
- Go to Settings (the gear icon) and select Workspace Settings.
- In the Apps and Features section, select OAuth Consumers.
- Click Add Consumer.
- Enter a name and description for your custom application.
- Set the callback URL:
- For desktop applications and headless machines, use http://localhost:33333 or another port number of your choice. The URI you set here becomes the CallbackURL property.
- For web applications, set the callback URL to a trusted redirect URL. This URL is the web location the user returns to with the token that verifies that your application has been granted access.
- If you plan to use client credentials to authenticate, you must select This is a private consumer. In the driver, you must set AuthScheme to client.
- Select which permissions to give your OAuth application. These determine what data you can read and write with it.
- To save the new custom application, click Save.
- After the application has been saved, you can select it to view its settings. The application's Key and Secret are displayed. Record these for future use. You will use the Key to set the OAuthClientId and the Secret to set the OAuthClientSecret.
See the help documentation for more information about the available connection properties and other configuration options for remoting.
- Update the [databases] section with the JDBC Connection URL for Bitbucket:
Start the MySQL daemon by specifying the configuration file or settings on the command line. The example below uses the included sample configuration file.
$ java -jar cdata.jdbc.bitbucket.jar -f "cdata.jdbc.bitbucket.remoting.ini"
Create the DSN
After connecting successfully to Bitbucket and starting the MySQL daemon, create a MySQL ODBC data source. When working with ODBC data sources, you specify connection properties in a DSN (data source name).
If you have not already obtained an ODBC driver and driver manager, refer to "Outlining the ESS Setup" to determine the components supported for your platform.
macOS
Follow the steps below to use the iODBC graphical administrator tool:
- Open iODBC by searching in the launchpad.
- On the System DSN tab, click Add and select Actual Open Source Databases.
- Provide the following information to complete the wizard:
- Name: Enter the DSN.
- Server: Enter 127.0.0.1 or the address of the machine where the MySQL daemon is running.
- Port: Enter the port that the daemon is listening on. For example, 3306.
- Database: Enter the name of a database specified in the config file for the daemon. For example, Bitbucket.
- In the Metadata tab, check the boxes for:
- "Ignore schema in column specifications"
- "Don't use INFORMATION_SCHEMA for metadata"
- Click Test Connection and enter your credentials in the dialog.
Windows
You can use the built-in Microsoft ODBC Data Source Administrator to create the ODBC DSN.
- From the Control Panel, select Set Up Data Sources (ODBC). The ODBC Data Source Administrator is displayed.
- On the System DSN tab, click Add and select the MySQL ODBC driver.
- Provide the following information to complete the wizard:
- Name: Enter the DSN.
- Server: Enter 127.0.0.1 or the address of the machine where the MySQL daemon is running.
- Port: Enter the port that the daemon is listening on. For example, 3306.
- Database: Enter the name of a database specified in the config file for the daemon. For example, Bitbucket.
- In the Metadata tab, check the boxes for:
- "Ignore schema in column specifications"
- "Don't use INFORMATION_SCHEMA for metadata"
- Click Test Connection and enter your credentials in the dialog.
Create Bitbucket Shadow Tables
Shadow tables exist in an external SQL source but can be used in much the same way as other tables in your FileMaker database; you can add them in the relationships graph, browse data, and create layouts on them.
- Click File -> Manage -> Database.
- On the Relationships tab of the resulting dialog, click the Add a Table button in the Table/Relationships section.
- In the Data Source menu, select Add ODBC Data Source and then select the DSN you created in the previous section.
After specifying the username and password for the DSN, you can add Bitbucket tables to the relationships graph. You can now scroll through, sort, edit, and summarize Bitbucket data by clicking View -> Browse Mode, just as you would a remote MySQL database.