Re: PDO_odbc: Parameter binding
| From: | Wez Furlong | Date: | Thu, 25 Nov 2004 14:44:20 +0000 |
| Subject: | Re: PDO_odbc: Parameter binding | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-1661@lists.php.net to get a copy of this message | ||
A backtrace would be warmly welcomed:
http://bugs.php.net/bugs-generating-backtrace.php
It will show exactly where the problem is.
--Wez
On Thu, 25 Nov 2004 13:49:03 +0100, Daniel Garcia <txa@quintopino.com> wrote:
> Hi,
>
> I'm trying to connect from SuSE Linux 9.0 through unixODBC to a DB2
> database living in an IBM iSeries server. I have successfully used this
> layout in different projects, mainly using PEAR DB for database access.
> Now I'd like to use PDO to call stored procedures.
>
> The problem is that I can't bind parameters (not even for a simple SQL
> query), since PDO_odbc silently dies.
>
> Following Wez's example in
> http://netevil.org/node.php?nid=44, I tried
> this code:
>
> try {
> $dbh = new PDO("odbc:iSeriesDSN", "user", "pass");
> $dbh->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_EXCEPTION);
>
> $dbh->exec("create table test(name varchar(255) not null primary key,
> value varchar(255))");
>
> // insert some data using a prepared statement
> $stmt = $dbh->prepare("insert into test (name, value) values
> (:name, :value)");
> $stmt->bindParam(':name', $name, PDO_PARAM_STR, 64);
> $stmt->bindParam(':value', $value, PDO_PARAM_STR, 64);
> $name = 'Foo';
> $value = 'Bar';
> $stmt->execute();
>
> } catch (PDOException $e) {
> echo "Error: " . $e->getMessage() . " - line " .
> $e->getLine();
> }
>
> Connection is established, the 'test' table is created fine, but the
> execution crashes when it arrives to the *prepare* statement.
>
> I'm not getting an error from the iSeries server (I do receive errors
> though if I try to create an existing table).
>
> Could it be a problem of PDO_odbc?