>>> On 1/23/2008 at 5:07 AM, in message
<0752652f-e99c-42b0-b638-e227857a0b55@j78g2000hsd.googlegroups.com>,
> On Jan 22, 11:00 pm, "Frank Swarbrick"
> <Frank.Swarbr...@efirstbank.com> wrote:
[quoted text clipped - 5 lines]
>
> Do you have a link to where this is described?
There is information about it in the Data Movement Utilities manual for DB2
version 9 under the heading "Moving data using the CURSOR file type".
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.
db2.udb.admin.doc/doc/c0005437.htm
Strangely, this option does not appear to be described in SQL Reference
Volume 2 for either DB2 9.1 or DB2 9.5.
Anyway, here is an example. This will load every row from table
SAFEBOX.TEST in remote database 'core' to table SAFEBOX.TEST in database
'mydb'. Database 'core' must be cataloged to the server that 'mydb' resides
on.
CONNECT TO mydb USER myuserid;
DECLARE mycurs CURSOR
DATABASE core
USER coremgr
USING ********
FOR SELECT * FROM SAFEBOX.TEST;
LOAD FROM mycurs OF CURSOR
REPLACE INTO SAFEBOX.TEST;
CONNECT RESET;
And here is the same example using the ADMIN_CMD SP:
CALL SYSPROC.ADMIN_CMD('LOAD FROM (DATABASE core SELECT * FROM safebox.test)
OF CURSOR MESSAGES ON SERVER REPLACE INTO safebox.test');
When using the SP you cannot supply a user ID and password, so the user ID
and password. It uses the user ID and password of the local server you are
logged on, so the same credentials must be in place on the remote server.
This is documented here:
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.
db2.udb.admin.doc/doc/r0023577.htm
specifically: "When the DATABASE database-alias clause is included prior to
the query statement in the parentheses, the LOAD command will attempt to
load the data using the query-statement from the given database as indicated
by the database-alias name, which is defined on the server. It must point to
a database exist on the server, and is a different database that the
application is currently connected to. Note that the LOAD will be executed
using the user ID and password explicitly provided for the currently
connected database (an implicit connection will cause the LOAD to fail)."
Frank
Lennart - 24 Jan 2008 07:19 GMT
On Jan 23, 5:58 pm, "Frank Swarbrick" <Frank.Swarbr...@efirstbank.com>
wrote:
> >>> On 1/23/2008 at 5:07 AM, in message
>
[quoted text clipped - 54 lines]
>
> Frank
Thanx a lot for the info Frank. I'm a bit busy at the moment, but I
will have a closer look as soon as possible.
/Lennart
bwmiller16@gmail.com - 24 Jan 2008 16:00 GMT
> On Jan 23, 5:58 pm, "Frank Swarbrick" <Frank.Swarbr...@efirstbank.com>
> wrote:
[quoted text clipped - 64 lines]
>
> - Show quoted text -
How many other gems are in DB2 that I didn't know about! Even when I
try to keep-up on the vast topic of DB2 it is impossible.
Thanks to Frank for asking this question.
-B
Frank Swarbrick - 25 Jan 2008 18:01 GMT
>>> On 1/24/2008 at 9:00 AM, in message
<e2cab84c-186f-4ecc-a1a4-c818ac31778f@d4g2000prg.googlegroups.com>,
> How many other gems are in DB2 that I didn't know about! Even when I
> try to keep-up on the vast topic of DB2 it is impossible.
>
> Thanks to Frank for asking this question.
Now you have me wondering where on earth I learned about this new feature.
It is in the "What's New" for version 9 in chapter 12 under "Load from
cursor with remote fetch". But I'm not sure if that's where I actually
heard about it first. I think perhaps someone posted about it in this
newsgroup.