Hi,
I have a db2 instance DATASERV with two databases DBMAIN and DBHAWK.
I am using db2/udb api to connect to DATASERV with user id(DSTAGE) and password.
The generated query is SELECT STAGEPARAM FROM DSTAGE.PARAM WHERE....
My concern is that both DBMAIN and DBHAWK has PARAM table, so how do I define which database the select should be done on.
Connect to multiple db2 databases
Moderators: chulett, rschirm, roy
Connect to multiple db2 databases
RELAXEN UND WATSCHEN DER BLINKENLICHTEN
Sorry, don't know DB2 but if 'database' in this context is anything like an Oracle 'schema' then you just preface the table name with the database name. So, perhaps something like?
Code: Select all
SELECT STAGEPARAM FROM DSTAGE.DBMAIN.PARAM WHERE....
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Hi Craig,
Thanks for the input. That worked on the older db (DBMAIN), but failed for the newer one.
Seems I need to run a CATALOG command which will make the ds server "aware" of the new remote database. Quite like creating aliases.
PS : They are quite different from oracle schema. Different databases running under a single server instance. Can be independently brought up/shut down etc. There are schemas under them... So I can address them as DBNAME.SCHEMANAME.TABLENAME.COLUMNNAME... phew...
Thanks for the input. That worked on the older db (DBMAIN), but failed for the newer one.
Seems I need to run a CATALOG command which will make the ds server "aware" of the new remote database. Quite like creating aliases.
PS : They are quite different from oracle schema. Different databases running under a single server instance. Can be independently brought up/shut down etc. There are schemas under them... So I can address them as DBNAME.SCHEMANAME.TABLENAME.COLUMNNAME... phew...
RELAXEN UND WATSCHEN DER BLINKENLICHTEN