DB2 As400 the rights tools

I should connect and query a db2 on a as400 server.
What’s the right tools ?
I mean I’ve to use
http://php.net/manual/en/ref.pdo-odbc.php
or
http://php.net/manual/en/ref.pdo-ibm.php
or
http://php.net/manual/en/book.ibm-db2.php

or what ?

When I get the connection can I do query in plain sql like
SELECT * FROM users or db2 has a dedicate language ?

Sorry but I’m completely new at db2 and as400

db2 uses SQL so you should be able to use calls that are the same or almost the same as you are used to with other databases that use SQL.

I’m assuming you’re working on an iSeries machine. If it’s on one of the later versions (v7r1 or higher) you can use this as a SQL guide http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_71/db2/rbafz.pdf.

Alan Seiden is the expert when it comes to PHP on iSeries. I’ve had the pleasure of working with him. Here’s a slide on the different options to connect to DB2 from PHP and best practices (http://www.alanseiden.com/presentation%20slides/DB2-and-PHP-best-practices-on-IBM-i.pdf). If you’re working with the PHP directly on the machine then you should be using db2_connect or db2_pconnect as it has the most DB2 specific features. If you want to connect from Linux, things are pretty complicated, but it’s possible and if you want the full db2 features you’ll need to purchase a license for DB2 Connect. Have a look at the slides.

Alan’s Zend Framework 1 DB2 adapter is a good place to look at and ZF 2’s DB2 adapter (http://www.alanseiden.com/2012/10/16/zf2-db2-ibm-i/ and https://github.com/zendframework/zf2/tree/master/library/Zend/Db/Adapter/Driver/IbmDb2).

Thanks a lot buddies.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.