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
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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: Tue Dec 11 22:01:26 2018 UTC