php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40695 odbc_execute/prepared statements does not work with Access
Submitted: 2007-03-02 18:34 UTC Modified: 2020-09-25 17:11 UTC
Votes:20
Avg. Score:4.5 ± 0.6
Reproduced:20 of 20 (100.0%)
Same Version:8 (40.0%)
Same OS:16 (80.0%)
From: a at bc dot de Assigned: cmb (profile)
Status: Not a bug Package: ODBC related
PHP Version: 5.2.1 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: a at bc dot de
New email:
PHP Version: OS:

 

 [2007-03-02 18:34 UTC] a at bc dot de
Description:
------------
[repost of bug 6275]

Hello,

My problem is odbc_execute fails with the following error message:

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver]COUNT field
incorrect , SQL state 07001 in SQLExecute in
d:\Inetpub\wwwroot\php\adodb\index.php on line 77

The odbc_exec INSERT works fine. I am using a plain vanilla NorthWind MS
Access database and am using the ISAPI version of PHP, with ODBC built
in.



Reproduce code:
---------------
$conn = odbc_connect("nwind","","");
odbc_exec($conn,"drop table ADOXYZ"); 
odbc_exec($conn,"create table ADOXYZ (id int, firstname char(24),
lastname char(24))"); 	
odbc_exec($conn,"insert into ADOXYZ (id,firstname,lastname) values
(0,'Zend','PHP')");
$stmt = odbc_prepare($conn,"insert into ADOXYZ (id,firstname,lastname)
values (?,?,?)");
if ($stmt) {
	print "Trying execute<br>";
	$stmt = odbc_execute($stmt,array(1,"John","Lim"));
}

Actual result:
--------------
Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver]COUNT field
incorrect , SQL state 07001 in SQLExecute in
d:\Inetpub\wwwroot\php\adodb\index.php on line 77

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-05 02:48 UTC] geoff dot brisbine at gmail dot com
It's happening for me on Windows XP Pro SP2 w/Apache 2.2 and PHP 5.2.6 (php5apache2_2.dll).
 [2008-09-05 03:11 UTC] geoff dot brisbine at gmail dot com
Forgot in last post, this is accessing Paradox 4.x tables.
 [2009-05-11 18:49 UTC] ilyalyu at yahoo dot com
This bug makes odbc unusable if you need to insert large data into the table. There are only two alternatives:
1. Use odbc_exec, which fails with large data because of stack limit.
2. Use odbc_prepare and odbc_execute, which fails because of the bug described above.
So, both alternatives fail.

OS Windowx XP, PHP Version 5.2.6, Database - Windows SQL Server 2008.
 [2020-09-25 17:11 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-09-25 17:11 UTC] cmb@php.net
With current PHP versions and the Microsoft Access Driver (*.mdb,
*.accdb) 14.00.7010.1000 the supplied test script fails with:

SQL error: [Microsoft][ODBC Driver Manager] The driver does not support this function, SQL state IM001 in SQLDescribeParameter

SQLDescribeParam() is a level 2 interface, and drivers are not
required to implement such functions.  However, the ODBC extension
needs to call this function, so there is nothing we can do about
that.

@ilyalyu at yahoo dot com, prepared statements should work fine
nowadays with the SQL Server ODBC drivers.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 00:01:36 2025 UTC