IBM DB2 and php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Maybe in early August, I got my code to work with DB2 8.1.3 via ODBC after a bit of teeth pulling.
I played with it for about 2-3 weeks, and it seemed ok (slow but ok).
Earlier this past week, I was modifying the DB drivers for my script,
and now, DB2 refuses to cooperate.
I don't remember changing any php.ini settings so Im confused as to why it doesn't work now.
Im testing on w2k, php 4.3.3, db2 8.1.3
The problem revolves around field lengths being too long, because, as soon as I select
a text field, the query fails, when trying to retrieve specific result rows.
If anyone can shed any light on this, I would greatly appreciate it.
Thanks


php.ini settings
----
; Handling of LONG fields. Returns number of bytes to variables. 0 means
; passthru.
odbc.defaultlrl = 4096

; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char.
; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
; of uodbc.defaultlrl and uodbc.defaultbinmode
odbc.defaultbinmode = 1
----


example script
----
|<?php
||// contains db connection stuff|
|include('include.php');

// body is a text field
$sql = 'select id, user_id, name, time, body, ip from NULLID.guestbook for read only';
$result = odbc_exec($db->_connection_id, $sql);

odbc_longreadlen($result, 0);
odbc_binmode($result, 0);

// Trying to retrieve 2nd row out of 6 rows returns false when
// the query contains a text field
var_dump(odbc_fetch_array($result, 2));

?>|

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux