RE: [PHP-INST] php on Windows with db2 odbc
| From: | Matt Schroebel | Date: | Mon, 14 Apr 2003 17:48:52 +0000 |
| Subject: | RE: [PHP-INST] php on Windows with db2 odbc | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-10624@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Thorsten Burg [mailto:thorsten.burg@burg-itc.de]
> Sent: Monday, April 14, 2003 1:13 PM
> To: php-install@lists.php.net
> Subject: [PHP-INST] php on Windows with db2 odbc
>
>
> Hello,
>
> I probably checked the whole php.net web site but could find
> a solution for
> my problem. I succesfully installed php on an windows server
> with apache.
> The problem that I am now facing is that I am trying to connect to an
> DB2/400 database via IBM odbc driver on an AS/400. I saw on
> the website that
> there is a compilation function "--with-ibm-db2" but only for Unix
> environments. On the other hand, the compilation instructions
> for windows
> does not contain such instructions. Does this mean that there
> is no such a
> function available for the windows compilation ?
>
> I hope that somebody can help me out.
I've only done this from Linux and on Linux you must install the ibm-db2
connect product, and then build php with the --with-ibm-db2 option.
Since you're on Windows, you need to install the ibm odbc driver on the
server from the Client Access CDROM, and then set up the dsn in windows
so that php can find it on the server. You also need to configure the
AS/400 to accept the odbc connection. Follow step 3 here:
http://www.php-faq.com/as400.php The rest of that
document is for Linux
DB2.
A few things you may want to know as well:
1. The AS/400 sql is case insensitive for the column names, but they'll
come back as they're defined (usually upper case only).
2. There's a function in the user notes in the odbc man pages on php.net
for obbc_fetch_array which you ought to get so you don't have to fumble
with column indexes as ints.
3. You can't quote numbers like in mysql (i.e. "insert into numbers
(NUMERIC_COLUMN) values('$numeric_field')"). I do that for security in
mysql so you can't add sql there, but the 400 chokes on it.
4. If you get a message that says:
SQL7008N REXX variable "TABLENAMEHERE" contains inconsistent data
It means that the tables being accessed on the AS/400 are not being
journaled. To correct the SQL7008N error, you need to start journaling
your tables or change the isolation level to No Commit.
5. The AS/400 needs '' instead of escaped quotes. Use this function:
$escapedValue = ereg_replace("'","''",$valueToEscape);
6. More info here: http://www.php-faq.com/#100