I need to "import" a text file located in the user computer, to a DB2 table in the database, what's the best way to do this?
You have a couple of options:
You could create a table with a CLOB column, store the text file in that column, and use LOB Locators to access the data. For more information on this technique, consult the Redbook "DB2 UDB for AS/400 Object Relational Support."
Another option would be to copy the text file to a stream file on the IFS and use the CPYFRMIMPF command. Example: CPYFRMIMPF FROMSTMF('/testdir/fromfile.txt') TOFILE(QGPL/TOFILE) MBROPT(*REPLACE) RCDDLM(*ALL) STRDLM(*NONE)
Dig Deeper on DB2 UDB (universal databases)
Related Q&A from Kent Milligan
To solve the SQL error -321 on IBM i6.1, use the new values statement to overcome the error. If you are using an older release, declare a cursor ... Continue Reading
When working with DB2 files with columns that have both short and long names, there is no option choose which column names are returned via ODBC ... Continue Reading
When developing tables in a parent-child relationship, use a primary key and a foreign key along with a unique ID to make your database easier to ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.