ODBC Data Connectors
These functions also work for accessing data in cloud applications from PHP, such as Mailchimp, Salesforce, Dynamics 365, BigCommerce, or QuickBooks.
- odbc_exec() function to execute an SQL statement;
- odbc_fetch_row() function to return records from the result set;
- odbc_result() function to read fields from a record;
- finally, odbc_close() function is used to close an ODBC connection.
ODBC database connection in PHP with
odbc_connect() function
$user = "myusername";
$password = "mypassword";
$ODBCConnection = odbc_connect("DRIVER={Devart ODBC Driver for SQLite};Direct=True;Database=mydatabase", $user, $password);
$SQLQuery = "SELECT * FROM autotest.dept"; $RecordSet = odbc_exec($ODBCConnection, $SQLQuery);
while (odbc_fetch_row($RecordSet)) {
$result = odbc_result_all($RecordSet, "border=1");
}
odbc_close($ODBCConnection);
Key Features
Direct mode
Native connection to traditional databases and cloud-based services from PHP using an ODBC driver. No need to use client software to fetch your sales figures table or a list of the best sales managers from popular data stores such as Oracle, MySQL, PostgreSQL, SQL Server, as well as cloud services such as Salesforce or Zoho CRM.
SQL data type mapping
Full support and mapping of data source-specific SQL data types to the standard ODBC data types. Access diverse data stores using PHP odbc driver, a unified interface with exceptional speed. You can create custom mappings between the data source fields and ODBC data types.
Secure connection
Devart ODBC drivers use SSL / SSH and HTTPS tunneling to protect user data as it flows between a remote server on the Internet and and the machine where your PHP code is executed. Tunneling allows you to send communications securely between machines.
ANSI SQL-92 standard support for cloud services
Devart ODBC drivers address one of the major challenges of retrieving data from email marketing, CRM, accounting and other cloud applications using PHP: their lack of adequate API support for SQL-92 standard SQL commands. Our drivers are designed to get the most out of cloud service APIs.
Why pick our ODBC drivers for your PHP application?
Fully Unicode-compliant ODBC drivers
Unicode is the universal standard for encoding characters in most languages. Our ODBC drivers provide a Unicode-compliant way to work with strings and characters in databases: they are capable of mapping Unicode function calls and string data types to ANSI encoding.
All major versions of data stores are supported
Our ODBC drivers can be used to interact and perform SQL CRUD operations on popular traditional databases and cloud services from PHP, such as MySQL, Oracle, PostgreSQL, Salesforce, or Mailchimp.
Regular feature updates and timely bug fixes
We frequently release new versions of ODBC drivers with new capabilities or enhancements for already existing features. Changes and new features are added to the roadmap based on customer feedback. Bug fixes and minor improvements are released as nightly builds to resolve issues in a timely fashion.
Strict compliance with Microsoft ODBC 3.52 Specification
Our ODBC drivers provide full support for the standard Open Database Connectivity API functions and data types. ODBC interface allows PHP to connect to ODBC databases using the SQL language. Additionally, we have designed Advanced Connection String parameters that implement different types of behavior.
Exceptional SQL query performance and bulk updates
Our ODBC drivers allow you to perform bulk record update with PHP in a single update statement while maintaining decent update speed. When you need to update a table with a million of records, you can use a single update operation which significantly reduces execution time compared to row-by-row operations.
Team of expert support engineers and community of developers
Contact our friendly knowledgeable support team for assistance if have any questions about using our ODBC drivers with PHP, or join our forum to discuss anything related to the database application development with other professional developers.
Frequently Asked Questions
ODBC is a connector that makes PHP development "agnostic" to database connectors. The connector uses functions like odbc_query() for databases like MySQL, PostgreSQL, SQLite and more.
The odbc_connect() function purpose is to connect to an ODBC data source.