Search code examples
phpsqldb2ibm-midrange

Using Unqualified SQL across multiple schemas in DB2 Express C


I'm trying to recreate part of the staging and production servers which run under IBM iSeries midrange servers on a local development server. My intended plan is to allow the SQL queries to work seamlessly with DB2 Express C installed on Linux. I got as far as installing PHP, the ibm_db2 PHP extension, and DB2 Express C. Everything works.

My next step is figuring out how to run unqualified SQL statements without specifying the schema. For instance on IBM iSeries, I can specify the i5_libl option with all of my schemas and then I don't have to worry about using fully qualified SQL. But I'm using Linux so the i5_libl option isn't available.

I looked at the DB2 SQL documentation for SET PATH and that's sorta what I want where I could specify multiple schemas, but my understanding is that it only works with CREATE, not static and dynamic SQL which is really all I care about. I also looked into SET SCHEMA and SET CURRENT PACKAGESET, but those only seem to allow only one schema.

For example:

I'll have table SCHEMA1.ABC and SCHEMA2.DEF.

I want to set it up so that I can just run the following from my application:

SELECT * FROM ABC

SELECT * FROM DEF

Solution

  • Scott Forstie mention your DB2 Express C installed on Linux tweet this morning.

    PHP ibm_db2 (test new features): IBM currently testing some new Open Source PHP ibm_db2 technology allows many/most IBM i settings over DB2 Connect V10.5 from Linux. If you are interested see the following Web site http://youngiprofessionals.com/wiki/index.php/XMLSERVICE/PHP , download section PHP ibm_db2 new features (test only), download test ibm_db2.zip file. To compile into your Linux machine PHP see README_IBM_i zip file, section called 'linux for IBM i people'.

    DB2 Connect V10.5 (with DB2 for i features): DB2 Connect V10.5 is a licensed program product that needs to be purchased. For production usage, the DB2 Connect Unlimited Edition for System i packaging typically offers the best terms for IBM i customers. Contact your local IBM representative or business partner for pricing information. For more information on this product, see the following Web site: http://www-03.ibm.com/software/products/en/db2connunlieditforsysti. A trial DB2 Connect license file for evaluation purposes can be obtained by sending an email to: [email protected]