Question

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
Was it helpful?

Solution 2

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: rmahendr@us.ibm.com

OTHER TIPS

The only way to do this is to define public aliases (synonyms) for the tables in question.

CREATE PUBLIC ALIAS ABC FOR SCHEMA1.ABC
CREATE PUBLIC ALIAS DEF FOR SCHEMA2.ABC

The CURRENT PATH register only affects the search for routines, and, as you've noticed, there can only be one CURRENT SCHEMA at a time.

Having said that, the value of developing on DB2 LUW an application hosted on iSeries is questionable, because the differences between the two platforms extend far beyond the SQL dialects they support.

I concur with @mustaccio - recreating an IBM i-like environment on a Linux machine is going to be a lot of work. You'd be better off simply creating a development environment up on the IBM i machine. Based solely on the nomenclature in the post, it sounds as if there's change management up there already; just ask the admins for a development environment.

Assuming that you've been down this road already and it's not feasible for some reason, if you really want a development environment on Linux, put all the tables in one schema. If there are duplicate names across schemas, you'll need to use aliases.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top