![]() |
VOOZH | about |
Drop the CData ODBC Driver for Adobe Target into your LAMP or WAMP stack to build Adobe Target-connected Web applications. This article shows how to use PHP's ODBC built-in functions to connect to Adobe Target data, execute queries, and output the results.
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 Adobe Target, you must provide the Tenant property along with OAuth connection properties mentioned below. Note that while other connection properties can influence processing behavior, they do not affect the ability to connect.
To determine your Tenant name:
You must set AuthScheme to OAuthClient for all user account flows.
Note: Adobe authentication via OAuth requires updating your token every two weeks.
Obtaining the OAuth Access Token
Set the following properties to connect:
With these settings, the provider obtains an access token from Adobe Target, which it uses to request data. The OAuth values are stored in the location specified by OAuthSettingsLocation, ensuring they persist across connections.
Open the connection to Adobe Target by calling the or methods. To close connections, use or .
$conn = odbc_connect("CData ODBC AdobeTarget 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 AdobeTarget 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 Activities WHERE Type = ?");
Execute prepared statements with .
$conn = odbc_connect("CData ODBC AdobeTarget Source","user","password");
$query = odbc_prepare($conn, "SELECT * FROM Activities WHERE Type = ?");
$success = odbc_execute($query, array('AB'));
Execute nonparameterized queries with .
$conn = odbc_connect("CData ODBC AdobeTarget Source","user","password");
$query = odbc_exec($conn, "SELECT Id, Name FROM Activities WHERE Type = 'AB'");
Access a row in the result set as an array with the function.
$conn = odbc_connect("CData ODBC Adobe Target data Source","user","password");
$query = odbc_exec($conn, "SELECT Id, Name FROM Activities WHERE Type = 'AB'");
while($row = odbc_fetch_array($query)){
echo $row["Id"] . "\n";
}
Display the result set in an HTML table with the function.
$conn = odbc_connect("CData ODBC Adobe Target data Source","user","password");
$query = odbc_prepare($conn, "SELECT * FROM Activities WHERE Type = ?");
$success = odbc_execute($query, array('AB'));
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 Adobe Target-specific adaptations of the PHP community documentation for all ODBC functions.
Download a free trial of the Adobe Target ODBC Driver to get started:
Download NowLearn more:
👁 Adobe Target IconThe Adobe Target ODBC Driver is a powerful tool that allows you to connect with live data from live Adobe Target, directly from any applications that support ODBC connectivity.
Read, write, and update online sheets through a standard ODBC interface.