Establishing a Connection
You can create and manage connections with the Data Explorer and the FireDAC Connection Editor wizards. See Connection Definitions for more information on creating connections from code and creating persistent, private, or temporary connections.
Connecting to WordPressNote: For now, only connecting to self hosted wordpress instances is supported by CData FireDAC Components for WordPress.
To connect to data, set the Url and provide authentication. You must set the URL to your wordpress site, otherwise an error will be thrown indicating that the site was not found.
For example, if your site is hosted in 'http://localhost/wp/wordpress', the URL should be 'http://localhost/wp/wordpress' and not 'htpp://localhost' .
Authenticating to WordPress
WordPress uses Basic or OAuth2.0 authentication.
Basic AuthenticationBasic authentication is recommended for a testing environment only.
OAuth AuthenticationSee the authentication guide in Connecting to WordPress.
Using the FireDAC Connection Editor
Complete the following steps to use the FireDAC Connection Editor to assign a WordPress connection to a TFDConnection object:
- Open a project and drop a TFDPhysCDataWordpressDriverLink from the Tool Palette onto the Form Designer.
- Drop a TFDConnection object onto the Form Designer.
- Double-click the TFDConnection and select CDataWordpress in the Driver Id menu.
- Define the necessary connection properties.
- To execute ad-hoc SQL statements based on this connection, enter SQL commands on the SQL Script tab.
- In the Form Designer, select the TFDConnection object and set the Connected property to true.
Using the Data Explorer
Complete the following steps to use the Data Explorer to define persistent connections that can be shared across applications and projects:
- Click View > Tool Windows > Data Explorer in RAD Studio and expand the FireDAC node.
- Right-click the CData WordPress Data Source node and click Add New Connection.
- Enter a name for the connection. The FireDAC Connection Editor opens.
Working with Persistent Connections
The connections you define in the Data Explorer can be assigned to a TFDConnection object by specifying the connection name in the TFDConnection object's ConnectionDefName property.
Browsing Data and Metadata
The Data Explorer also provides options for browsing WordPress objects at design time:
- Expand the CData WordPress Data Source node in the Data Explorer to view the defined connections.
- Expand a connection node to find the database objects available for a connection.
- Drill down to a database object to find metadata such as primary keys.
- To display data, double-click a table or view or right-click and click View.