I recently caught up with Seiden Group CTO Stephanie Rabbani about the ODBC driver that’s quickly becoming standard for open source and web connections on Db2 for i.
Steph, looks like ODBC is back! Where has it been for the past 20 years?
I guess it was hibernating! My understanding is that with the ODBC standard, IBM Rochester no longer needs to create and maintain unique adapters for all the new languages coming to the platform. Most languages can already use ODBC. What’s more, IBM already maintained ODBC drivers for Windows and Linux, so why not the IBM i itself? And now Apple Mac computers. Plus, ODBC works really well.
How are you using ODBC with PHP these days?
ODBC is our go-to driver for the PHP RPMs. Since Zend Server Basic is being discontinued next year, we’re helping lots of clients migrate to the PHP RPMs! We do maintain a high quality 64-bit build of ibm_db2 for clients who need backward compatibility, but ODBC is the standard going forward.
Which PHP extensions do you use?
PHP provides a choice of two ODBC extensions: ‘odbc’ and ‘PDO_ODBC.’ We usually prefer PDO_ODBC. Not only is PDO_ODBC compatible with other PDO database extensions, but it does more than the old ‘odbc’ extension. For example, PDO_ODBC can read output parameters from Db2 for i stored procedures.
Any other languages?
I love Python (let us know if you need Python code developed or need training!) and use pyodbc. Liam [Allan] has been developing APIs with Node.js and node-odbc. Oh, and let me know if you’d like to see how I produced beautiful graphs based on IBM i data with the R language and RODBC.
What do other developers say about ODBC being available on IBM i?
They love being able to run the same code from their PCs and on IBM i, connecting to Db2 for i from both. They can use their “local” development tools while programming, then deploy to the i.
How do you install the ODBC driver?
It’s free for IBM i customers. The package has two parts: the industry-standard unixODBC driver manager and a specific Db2 for i driver. You’ll need your IBM user ID to log in to the Access Client Solutions site and download the package. Our friend Mark Irish has provided official installation instructions:
If you want more installation tips, check out Alan Seiden and Richard Schoen’s The Zen of Using PHP without Zend Server.
How easy is ODBC to configure?
As a programmer who likes to dive right in, I love simple INI files where I can try all the options. And INI files (odbc.ini and odbcinst.ini, both in /qopensys/etc/) are what unixODBC gives us. There are a ton of options, and best of all, they are well documented.
IBM’s list of connection keywords: https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzaik/connectkeywords.htm
Some people also like this database-neutral unixODBC documentation: http://www.unixodbc.org/odbcinst.html
What about performance?
My testing with Neoload shows better performance with less CPU than the older proprietary drivers! For best speed, I recommend either connection pooling, or persistent connections if your language supports it.
Thanks, Steph! Any other words of wisdom?
I love to help people get started with ODBC and open source on IBM i. Why not save yourself some time? Contact me if you’d like me to walk you though the installation on your system and make sure it all works perfectly!