I'm using CentOS 6.5 to create a PDO ODBC connection to a Microsoft Access .mdb file through PHP.
I'm using MDBTools and unixODBC.
My odbcinst.ini looks like this
[MDBToolsODBC]
Description=MDBTools Driver
Driver=/usr/lib64/libmdbodbc.so.0.0.0
FileUseage=1
Threading=1
My odbc.ini looks like this
[dashboard]
Description = Dashboard
Driver = MDBToolsODBC
Servername = localhost
Database = /mnt/inetpub/databases/dashboard.mdb
Username =
Password =
I am trying to connect through PHP like so
$db = new PDO("odbc:DRIVER=MDBToolsODBC;DSN=dashboard;");
After hours of getting error messages, I've finally been able to solve them all, but now when I try to connect, Google Chrome says
No data received
Unable to load the webpage because the server sent no data.
Error code: ERR_EMPTY_RESPONSE
I'm not sure if this is because of my DSN set up or not. When I do a isql dashboard
I get
+----------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+----------------------------------+
Not sure how to go about resolving this as this is my first time using any form of linux.
Here is how I'm trying to call up the information from the database.
In files that need database information, I use
<?php
include("inc/config.php");
?>
Commenting out the connection string
//$db = new PDO("odbc:DRIVER=MDBToolsODBC;DSN=dashboard;");
allows the HTML and CSS to load, but of course no data from the database is pulled. This is what makes me think there is an issue with the connection string of some sort.
I'm trying to perform a simple SQL query like so, which is a much more simple query than the ones I need to run and use in my development but if I can get something simple like this to work I can figure out the rest.
$problems = $db->prepare("SELECT problems.id FROM problems;");
$problems->execute();
$result = $problems->fetchColumn();
echo $result;
EDIT: I have identified that there is a 'Segmentation Fault' in the table I am trying to query. Other tables appear to be working fine!