We are proud to share our inclusion in the 2024 Gartner Magic Quadrant for Data Integration Tools. We believe this recognition reflects the differentiated business outcomes CData delivers to our customers.
Get the Report →Load Paylocity Data to a Database Using Embulk
Use CData JDBC drivers with the open source ETL/ELT tool Embulk to load Paylocity data to a database.
Embulk is an open source bulk data loader. When paired with the CData JDBC Driver for Paylocity, Embulk easily loads data from Paylocity to any supported destination. In this article, we explain how to use the CData JDBC Driver for Paylocity in Embulk to load Paylocity data to a MySQL dtabase.
With built-in optimized data processing, the CData JDBC Driver offers unmatched performance for interacting with live Paylocity data. When you issue complex SQL queries to Paylocity, the driver pushes supported SQL operations, like filters and aggregations, directly to Paylocity and utilizes the embedded SQL engine to process unsupported operations client-side (often SQL functions and JOIN operations).
Configure a JDBC Connection to Paylocity Data
Before creating a bulk load job in Embulk, note the installation location for the JAR file for the JDBC Driver (typically C:\Program Files\CData\CData JDBC Driver for Paylocity\lib).
Embulk supports JDBC connectivity, so you can easily connect to Paylocity and execute SQL queries. Before creating a bulk load job, create a JDBC URL for authenticating with Paylocity.
Set the following to establish a connection to Paylocity:
- RSAPublicKey: Set this to the RSA Key associated with your Paylocity, if the RSA Encryption is enabled in the Paylocity account.
This property is required for executing Insert and Update statements, and it is not required if the feature is disabled.
- UseSandbox: Set to true if you are using sandbox account.
- CustomFieldsCategory: Set this to the Customfields category. This is required when IncludeCustomFields is set to true. The default value for this property is PayrollAndHR.
- Key: The AES symmetric key(base 64 encoded) encrypted with the Paylocity Public Key. It is the key used to encrypt the content.
Paylocity will decrypt the AES key using RSA decryption.
It is an optional property if the IV value not provided, The driver will generate a key internally. - IV: The AES IV (base 64 encoded) used when encrypting the content. It is an optional property if the Key value not provided, The driver will generate an IV internally.
Connect Using OAuth Authentication
You must use OAuth to authenticate with Paylocity. OAuth requires the authenticating user to interact with Paylocity using the browser. For more information, refer to the OAuth section in the Help documentation.
The Pay Entry API
The Pay Entry API is completely separate from the rest of the Paylocity API. It uses a separate Client ID and Secret, and must be explicitly requested from Paylocity for access to be granted for an account. The Pay Entry API allows you to automatically submit payroll information for individual employees, and little else. Due to the extremely limited nature of what is offered by the Pay Entry API, we have elected not to give it a separate schema, but it may be enabled via the UsePayEntryAPI connection property.
Please be aware that when setting UsePayEntryAPI to true, you may only use the CreatePayEntryImportBatch & MergePayEntryImportBatchgtable stored procedures, the InputTimeEntry table, and the OAuth stored procedures. Attempts to use other features of the product will result in an error. You must also store your OAuthAccessToken separately, which often means setting a different OAuthSettingsLocation when using this connection property.
Built-in Connection String Designer
For assistance in constructing the JDBC URL, use the connection string designer built into the Paylocity JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.paylocity.jar
Fill in the connection properties and copy the connection string to the clipboard.
![Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)](../articles/jdbc-url-builder-0.png)
Below is a typical JDBC connection string for Paylocity:
jdbc:paylocity:OAuthClientID=YourClientId;OAuthClientSecret=YourClientSecret;RSAPublicKey=YourRSAPubKey;Key=YourKey;IV=YourIV;InitiateOAuth=GETANDREFRESH
Load Paylocity Data in Embulk
After installing the CData JDBC Driver and creating a JDBC connection string, install the required Embulk plugins.
Install Embulk Input & Output Plugins
- Install the JDBC Input Plugin in Embulk.
https://github.com/embulk/embulk-input-jdbc/tree/master/embulk-input-jdbc - In this article, we use MySQL as the destination database. You can also choose SQL Server, PostgreSQL, or Google BigQuery as the destination using the output Plugins.
https://github.com/embulk/embulk-output-jdbc/tree/master/embulk-output-mysqlembulk gem install embulk-output-mysql
embulk gem install embulk-input-jdbc
With the input and output plugins installed, we are ready to load Paylocity data into MySQL using Embulk.
Create a Job to Load Paylocity Data
Start by creating a config file in Embulk, using a name like paylocity-mysql.yml.
- For the input plugin options, use the CData JDBC Driver for Paylocity, including the path to the driver JAR file, the driver class (e.g. cdata.jdbc.paylocity.PaylocityDriver), and the JDBC URL from above
- For the output plugin options, use the values and credentials for the MySQL database
Sample Config File (paylocity-mysql.yml)
in:
type: jdbc
driver_path: C:\Program Files\CData[product_name] 20xx\lib\cdata.jdbc.paylocity.jar
driver_class: cdata.jdbc.paylocity.PaylocityDriver
url: jdbc:paylocity:OAuthClientID=YourClientId;OAuthClientSecret=YourClientSecret;RSAPublicKey=YourRSAPubKey;Key=YourKey;IV=YourIV;InitiateOAuth=REFRESH
table: "Employee"
out:
type: mysql
host: localhost
database: DatabaseName
user: UserId
password: UserPassword
table: "Employee"
mode: insert
After creating the file, run the Embulk job.
embulk run paylocity-mysql.yml
After running the the Embulk job, find the Salesforce data in the MySQL table.
Load Filtered Paylocity Data
In addition to loading data directly from a table, you can use a custom SQL query to have more granular control of the data loaded. You can also perform increment loads by setting a last updated column in a SQL WHERE clause in the query field.
in:
type: jdbc
driver_path: C:\Program Files\CData[product_name] 20xx\lib\cdata.jdbc.paylocity.jar
driver_class: cdata.jdbc.paylocity.PaylocityDriver
url: jdbc:paylocity:OAuthClientID=YourClientId;OAuthClientSecret=YourClientSecret;RSAPublicKey=YourRSAPubKey;Key=YourKey;IV=YourIV;InitiateOAuth=REFRESH
query: "SELECT FirstName, LastName FROM Employee WHERE [RecordId] = 1"
out:
type: mysql
host: localhost
database: DatabaseName
user: UserId
password: UserPassword
table: "Employee"
mode: insert
More Information & Free Trial
By using CData JDBC Driver for Paylocity as a connector, Embulk can integrate Paylocity data into your data load jobs. And with drivers for more than 200+ other enterprise sources, you can integrate any enterprise SaaS, big data, or NoSQL source as well. Download a 30-day free trial and get started today.