From: jiunarayan at gmail dot com
Operating system: linux
PHP version: 5.2.6
PHP Bug Type: ODBC related
Bug description: odbc_execute throws sql error code 01S02.
Description:
------------
I wanted to get the stored procedure of SQL Server2000 using odbc
driver.My system configuration is Linux where I used freeTDS to connect to
odbc, PHP version 5.2. I used the odbc_prepare() and odbc_execute() method
to access the stored procedure but it throws the SQL error code 01S02. I
have tried in many ways to solve this out but I failed. Can anyone help me
out????? Has any one called the stored procedures of SQL Server2000 using
odbc, in Linux????
Reproduce code:
---------------
<?php
$dsn="MSSQLTestServer";
$user="sa";
$pwd="sysadmin";
$con = odbc_connect($dsn,$user,$pwd,SQL_CUR_USE_ODBC )or die("couldn't
connect\n");
echo "connected TO DB ***";
$stmt = odbc_prepare($con,'CALL phptestproc') or die("failed
odbc_prepare\n");
echo "\nodbc_prepare ***".$stmt;
$a = array("India",1000);
$success = odbc_execute($stmt,$a)or die("error in odbc_execute");
odbc_commit($con);
odbc_close($con);
echo "Successfully added into the database"
?>
Expected result:
----------------
The stored procedure in SQL Server2000-[ phptestproc =ALTER procedure
phptestprocnew @name varchar(20),@age int
as insert into phptest values(@name,@age) ] gets successfully updated
Actual result:
--------------
connected TO DB ***
odbc_prepare ***Resource id #2<br />
<b>Warning</b>: SQL error: [unixODBC][Driver Manager]Option value
changed, SQL state 01S02 in SQLExecute in
<b>/home/projects/php_project/aphp.php</b> on line <b>18</b><br />
--
Edit bug report at http://bugs.php.net/?id=46008&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46008&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46008&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46008&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46008&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=46008&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46008&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46008&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46008&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46008&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46008&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46008&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46008&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46008&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46008&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46008&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46008&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46008&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46008&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46008&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46008&r=mysqlcfg