I am trying to connect to db2 database (server2) to export data from table to a csv file, for this I am using clpplus from the local server (server1) (which I want to export the csv to), the reason I want the CSV file to be on server1 is that I want to import it to a VERTICA database using COPY command
clpplus db2admin/Password@server2-ip:50000/SAMPLE
then I run
EXPORT TO C:\Data\alarms.csv OF DEL MODIFIED BY NOCHARDEL SELECT * FROM v_alarms;
The thing is that alarms.csv
file is created on server2, but I want it to be created on server1.
I tried something like
EXPORT TO server1-ip\C:\Data\alarms.csv OF DEL MODIFIED BY NOCHARDEL SELECT * FROM v_alarms;
but doesn't seem to work as it returns an I/O error
SQL3001C An I/O error (reason = "sqlofopn -2029060079") occurred while opening the output file
db2level
command returns:
on server1:
DB21085I This instance or install (instance name, where applicable: "DB2") uses "64" bits and DB2 code release "SQL11050" with level identifier "0601010F". Informational tokens are "DB2 v11.5.0.1077", "s1906101300", "DYN1906101300WIN64", and Fix Pack "0". Product is installed at "C:\PROGRA~1\IBM\SQLLIB" with DB2 Copy Name "DB2COPY1".
on server2:
DB21085I This instance or install (instance name, where applicable: "DB2") uses "64" bits and DB2 code release "SQL11050" with level identifier "0601010F". Informational tokens are "DB2 v11.5.0.1077", "s1906101300", "DYN1906101300WIN64", and Fix Pack "0". Product is installed at "C:\PROGRA~1\IBM\SQLLIB" with DB2 Copy Name "DB2COPY1".
With Db2 11.5/Db2 Warehouse you can use EXTERNAL TABLES to export the data with CLPPlus, e.g:
Then:
REMOTESOURCE
is the keyword to store the data in different location than the server (you can e.g. use LZ4 to compress the data before sending, which can help if the dataset is large).For the possible
options
values, see the documentation forCREATE EXTERNAL TABLE
. Of course you can also use full Db2 client, as mao explained.