How to connect ODBC Database with PHP?
The Microsoft Open Database Connectivity (ODBC) is a C application programming language interface. So the applications can access data from different database management systems. The designers of ODBC aimed to make it independent of database systems and operating systems. In this article, we are using the Microsoft Access database to establish a connection.
Requirements: If ODBC Drivers are installed or the old version is installed, then update to the latest version or install the driver first
- Start XAMPP server by starting Apache
- Write PHP script for Access database connection.
- Run it in a local browser.
- The database is successfully connected.
Steps to follow for ODBC connection to an MS Access Database:
- Open the Administrative tools icon in your control panel
- Double-click on the Data Sources (ODBC) icon inside.
- Choose the System DSN tab.
- Click on Add in the System DSN tab.
- Select the Microsoft Access Driver, Click Finish
- In the next screen, click on select to locate the database
- Give the database a Data Source Name (DSN) as shown in the above image. Click ok.
Example: The following example demonstrates the simple connection script.
Below output will be shown on the browser
Connection Successful !