php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77252 PDO ODBC.accdb cannot connect
Submitted: 2018-12-06 16:48 UTC Modified: 2018-12-06 23:16 UTC
From: xxalfa at gmail dot com Assigned:
Status: Open Package: PDO ODBC
PHP Version: 7.3.0 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: xxalfa at gmail dot com
New email:
PHP Version: OS:

 

 [2018-12-06 16:48 UTC] xxalfa at gmail dot com
Description:
------------
Fatal error: Uncaught PDOException: SQLSTATE[IM002] SQLDriverConnect: 0 [Microsoft][ODBC Driver Manager]
The data source name was not found, and no default driver was specified in C:\test.php:29
C:\test.php(29): PDO->__construct('odbc:Driver={Mi...')
With an older PHP version it worked.

Test script:
---------------
<?php

    //-------------------------------------------------
    // HEAD
    //-------------------------------------------------

    declare( strict_types = 1 );

    error_reporting( -1 );

    ini_set( 'html_errors', '0' );

    ini_set( 'display_errors', '1' );

    define( 'CORE_DIR', dirname( __FILE__ ) . DIRECTORY_SEPARATOR );

    header( 'Content-Type:text/plain' );

    //-------------------------------------------------
    // CODE
    //-------------------------------------------------

    echo PHP_VERSION . PHP_EOL;

    extension_loaded( 'pdo_odbc' ) or trigger_error( 'The pdo odbc extension is required.', E_USER_ERROR );

    $database_path = CORE_DIR . 'test.accdb';

    file_exists( $database_path ) or trigger_error( 'Could not find database file.', E_USER_ERROR );

    $database = new PDO( 'odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)}; Dbq=' . $database_path );

    // $database = new PDO( 'odbc:Driver={Microsoft Access Driver (*.accdb)}; Dbq=' . $database_path . '; Uid=; Pwd=;' );

    // $database = odbc_connect( 'Driver={Microsoft Access Driver (*.mdb, *.accdb)}; Dbq=' . $database_path, '', '');

?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-12-06 23:16 UTC] cmb@php.net
-Package: ODBC related +Package: PDO ODBC
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Mon Dec 10 08:01:24 2018 UTC