Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Connect to Bitbucket Data in DigitalSuite Studio through RunMyProcess DSEC
Use Arkobi Digital's low-code cloud native platform RunMyProcess's DigitalSuite EnterpriseConnect (DSEC) to connect to Bitbucket.
The CData JDBC Driver for Bitbucket implements JDBC Standards and enables a applications ranging from BI to IDE to connect with Bitbucket. In this article, we describe how to connect to Bitbucket data from Arkobi Digital RunMyProcess's DSEC and connect to Bitbucket in RunMyProcess.
Setting up EnterpriseConnect Agent
Configure the EnterpriseConnect Agent following the EnterpriseConnect page in the RunMyProcess documentation.
Setting up JDBC Adapter
The JDBC Adapter section describes the steps to connect to RDBMS through JDBC. Follow the steps and open the JDBC.config file.
- Create a JSON entry for the CData JDBC Driver for Bitbucket, e.g.
Bitbucket = { "sqlDriver" : "...", "sqlSource" : "...", "sqlDriverPath" : "..." }
- Set the "sqlDriver" field to the Class name for the CData JDBC Driver, e.g.
cdata.jdbc.bitbucket.BitbucketDriver - Set the "sqlSource" field to a JDBC URL for connecting to Bitbucket, e.g.
jdbc:bitbucket:Workspace=myworkspaceslug;Schema=InformationInitiateOAuth=GETANDREFRESHBuilt-in Connection String Designer
For assistance in constructing the JDBC URL, use the connection string designer built into the Bitbucket JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.bitbucket.jar
Fill in the connection properties and copy the connection string to the clipboard.
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.
- Set the "sqlDriverPath" field to the name of the CData JDBC Driver JAR file, e.g.
cdata.jdbc.bitbucket.jar
Sample JDBC.config File
#DBAgent Configuration
Bitbucket = {"sqlDriver" : "cdata.jdbc.bitbucket.BitbucketDriver", "sqlSource" = "jdbc:bitbucket:Workspace=myworkspaceslug;Schema=Information","sqlDriverPath" = "cdata.jdbc.bitbucket.jar" }
Put the JDBC driver JAR file (cdata.jdbc.bitbucket.jar) into the same directory as unified-adapter-[version].jar.
Note: Make sure to put the CData license file (cdata.jdbc.bitbucket.lic) into the same directory. Since the license is generated based on the unique identifier of the machine where the product in installed, you will need an offline activation if you want to put the file on another machine.
Starting DigitalSuite EnterpriseConnect Agent
In Windows, start RunMyProcess DigitalSuite EnterpriseConnect Agent in Windows services. To start the application through command line, see Starting the EnterpriseConnect Agent in the RunMyProcess documents.
Starting the JDBC Adapter
Start the JDBC Adapter from runAdapter.bat. Once the Adapter is running, you can access the application through the agent address (e.g. 127.0.0.1:8080). Below is an example executing the command in Windows.
... > java -Djava.util.logging.config.file=./log.properties -cp lib/* org.runmyprocess.sec2.AdapterHandler :
2021-06-09 14:37:58|INFO|correlationId=|Searching for config file...
2021-06-09 14:37:58|INFO|correlationId=|Adapter Handler started with [JDBC] configuration
2021-06-09 14:37:59|INFO|correlationId=|agent address: 127.0.0.1:8080
2021-06-09 14:38:00.251:INFO::ConnectionThread: Logging initialized @1820ms to org.eclipse.jetty.util.log.StdErrLog
2021-06-09 14:38:00|INFO|correlationId=|onConnect() websocket connection between Agent and Adapter established
Once the DigitalSuite EnterpriseConnect Agent and JDBC Adapter are running, access http://localhost:(specified-port-number)/ through your browser to open the page shown below.
Check the availability of the JDBC Adapter using tools such as Postman or cURL. Here, we use Postman to send the HTTP POST request.
Configure the RequestHeader as follows:
Content-Type application/json
Configure the RequestBody as follows:
{
"protocol":"JDBC",
"data":{
"DBType":"Bitbucket",
"sqlUsername":"",
"sqlPassword":"",
"sqlStatement":"SELECT * FROM Issues"
}
}
If the JDBC.config file contains credential information, sqlUsername and sqlPassword can be left empty. If you are not sure of the table name, you can retrieve the list of tables using the request SELECT * FROM sys_tables
The request is successful if the Status is 200 and the Body contains Bitbucket data in JSON format.
Connect to Bitbucket through DSEC Agent in DigitalSuite Studio
Create a DigitalSuite Studio project and then create a Provider in the project.
- URL: The URL for accessing JDBC Agent (e.g. http:localhost:8080/)
- Authentication Scheme: Login/password
- Login: The value from agent.user in the application.properties file
- Password: agent.password in the application.properties file
- Secured: Checked
- Use DigitalSuite EnterpriseConnect: Checked
- With domain: The value from agent.domain in application.properties file
Next, create a Connector in the Provider.
- Connector URL: Leave this empty
- Architecture: REST/XML-RPC
- Method: POST
- Result format: JSON
- Accept media type: application/json
- Character set: Automatic
- Content: Same as the Request body used in the JDBC Adapter
- Content type: application/json
The JSON data we used as the Request body in JDBC Adapter:
{
"protocol":"JDBC",
"data":{
"DBType":"Bitbucket",
"sqlUsername":"",
"sqlPassword":"",
"sqlStatement":"SELECT * FROM Issues"
}
}
Open Launch Test to perform the test. The test is successful if Bitbucket data is shown in Result on the right pane.
Now you can use Bitbucket data in RunMyProcess DigitalSuite Studio through DSEC.
For the detailed information on supported SQL commands, refer to the SQL Compliance section in our help documentation. For information on tables, refer to the Data Model section.