Normally, you would run the DB2 LOAD on the DB2 server. But, when you try to run DB2 LOAD from a client, you need to take care of few things.
A sample DB2 LOAD script that runs well on Server.
SET CURRENT SCHEMA="ADMIN"; LOAD FROM "C:\load\logos.txt" OF DEL LOBS FROM "C:\load\lobs\logos\" MODIFIED BY LOBSINFILE COLDEL~ ANYORDER USEDEFAULTS KEEPBLANKS CHARDEL"" DELPRIORITYCHAR DUMPFILE="C:\dump\logos.txt" METHOD P (1,2,3) MESSAGES "C:\msg\logos.txt" REPLACE INTO "LOGOS" ( ID, LOGO, SERVICERID ) STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL COPY NO INDEXING MODE AUTOSELECT ;
Suppose you want to run above LOAD operation from a client, you will need to make sure of the following.
- You need to specify CLIENT after LOAD keyword.
- DUMPFILE and LOBS FROM modifiers refer to the files on the server.
- Code page conversion is not performed during a remote load operation. If the code page of the data is different from that of the server, the data code page should be specified using the codepage modifier.
The modified LOAD command will look like this.
SET CURRENT SCHEMA="ADMIN"; LOAD CLIENT FROM "C:\load\logos.txt" OF DEL LOBS FROM "C:\load\lobs\logos\" MODIFIED BY LOBSINFILE COLDEL~ ANYORDER USEDEFAULTS KEEPBLANKS CHARDEL"" DELPRIORITYCHAR DUMPFILE="C:\dump\logos.txt" METHOD P (1,2,3) MESSAGES "C:\msg\logos.txt" REPLACE INTO "LOGOS" ( ID, LOGO, SERVICERID ) STATISTICS YES WITH DISTRIBUTION AND DETAILED INDEXES ALL COPY NO INDEXING MODE AUTOSELECT ;
The change is only in the keyword CLIENT but you need to make sure that the DUMPFILE and LOBS FROM path folders should reside on server and not on the client.
If LOAD can not find above path, you will encounter a SQL Error SQL2036N.
The path for the file or device “C:\dump\logos.txt” is not valid.
Sometimes you might get error SQL2036N even if you try to load the data from the server itself. In that case, it is normally permission issue on the file. This happens when you do the LOAD as a non-instance user.