![]() |
VOOZH | about |
Drop the CData ODBC Driver for Workday into your LAMP or WAMP stack to build Workday-connected Web applications. This article shows how to use PHP's ODBC built-in functions to connect to Workday data, execute queries, and output the results.
CData provides the easiest way to access and integrate live data from Workday. Customers use CData connectivity to:
Users frequently integrate Workday with analytics tools such as Tableau, Power BI, and Excel, and leverage our tools to replicate Workday data to databases or data warehouses. Access is secured at the user level, based on the authenticated user's identity and role.
For more information on configuring Workday to work with CData, refer to our Knowledge Base articles: Comprehensive Workday Connectivity through Workday WQL and Reports-as-a-Service & Workday + CData: Connection & Integration Best Practices.
If you have not already, first specify connection properties in an ODBC DSN (data source name). This is the last step of the driver installation. You can use the Microsoft ODBC Data Source Administrator to create and configure ODBC DSNs.
To connect to Workday, users need to find the Tenant and BaseURL and then select their API type.
To obtain the BaseURL and Tenant properties, log into Workday and search for "View API Clients." On this screen, you'll find the Workday REST API Endpoint, a URL that includes both the BaseURL and Tenant.
The format of the REST API Endpoint is: https://domain.com/subdirectories/mycompany, where:
The value you use for the ConnectionType property determines which Workday API you use. See our Community Article for more information on Workday connectivity options and best practices.
| API | ConnectionType Value |
|---|---|
| WQL | WQL |
| Reports as a Service | Reports |
| REST | REST |
| SOAP | SOAP |
Your method of authentication depends on which API you are using.
See the Help documentation for more information on configuring OAuth with Workday.
Open the connection to Workday by calling the or methods. To close connections, use or .
$conn = odbc_connect("CData ODBC Workday Source","user","password");
Connections opened with are closed when the script ends. Connections opened with the method are still open after the script ends. This enables other scripts to share that connection when they connect with the same credentials. By sharing connections among your scripts, you can save system resources, and queries execute faster.
$conn = odbc_pconnect("CData ODBC Workday Source","user","password");
...
odbc_close($conn); //persistent connection must be closed explicitly
Create prepared statements and parameterized queries with the function.
$query = odbc_prepare($conn, "SELECT * FROM Workers WHERE Legal_Name_Last_Name = ?");
Execute prepared statements with .
$conn = odbc_connect("CData ODBC Workday Source","user","password");
$query = odbc_prepare($conn, "SELECT * FROM Workers WHERE Legal_Name_Last_Name = ?");
$success = odbc_execute($query, array('Morgan'));
Execute nonparameterized queries with .
$conn = odbc_connect("CData ODBC Workday Source","user","password");
$query = odbc_exec($conn, "SELECT Worker_Reference_WID, Legal_Name_Last_Name FROM Workers WHERE Legal_Name_Last_Name = 'Morgan'");
Access a row in the result set as an array with the function.
$conn = odbc_connect("CData ODBC Workday data Source","user","password");
$query = odbc_exec($conn, "SELECT Worker_Reference_WID, Legal_Name_Last_Name FROM Workers WHERE Legal_Name_Last_Name = 'Morgan'");
while($row = odbc_fetch_array($query)){
echo $row["Worker_Reference_WID"] . "\n";
}
Display the result set in an HTML table with the function.
$conn = odbc_connect("CData ODBC Workday data Source","user","password");
$query = odbc_prepare($conn, "SELECT * FROM Workers WHERE Legal_Name_Last_Name = ?");
$success = odbc_execute($query, array('Morgan'));
if($success)
odbc_result_all($query);
You will find complete information on the driver's supported SQL in the help documentation. The code examples above are Workday-specific adaptations of the PHP community documentation for all ODBC functions.
Download a free trial of the Workday ODBC Driver to get started:
Download NowLearn more:
👁 Workday IconThe Workday ODBC Driver is a powerful tool that allows you to connect with live data from Workday, directly from any applications that support ODBC connectivity.
Access Workday data like you would a database - read, write, and update Workday Cash Management, Compensation, Financial Management, Payroll, etc. through a standard ODBC Driver interface.