djinncoyote (
djinncoyote) wrote2018-08-14 12:01 am
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Entry tags:
DB2 errors with misleading descriptions
Today, I wrote a PowerShell script to generate SQL files with INSERT statements containing test data for my database.
I then applied the SQL files against my database using the "DB2 -tvf [SQL file] -z [output file]" command.
The first problem I encountered was this error message:
DB21005E An error occurred while accessing the file "[output file]"
I checked and double-checked the output file name and path, and couldn't find anything wrong with it.
The error, it turns out, was due to me running the DB2 -tvf command from a regular Windows command window. It needs to be run from a DB2 command window.
The next problem was this error message:
DB21007E End of file reached while reading the command.
This error was due to my PowerShell script having generated the SQL files with the "UCS-2 LE BOM" encoding, while the DB2 command apparently only accepts files with UTF-8 encoding, and without the byte order mark. I'm actually not sure yet if that is the only format that DB2 accepts, or if it is related to which encoding the database in question is using.
I then applied the SQL files against my database using the "DB2 -tvf [SQL file] -z [output file]" command.
The first problem I encountered was this error message:
DB21005E An error occurred while accessing the file "[output file]"
I checked and double-checked the output file name and path, and couldn't find anything wrong with it.
The error, it turns out, was due to me running the DB2 -tvf command from a regular Windows command window. It needs to be run from a DB2 command window.
The next problem was this error message:
DB21007E End of file reached while reading the command.
This error was due to my PowerShell script having generated the SQL files with the "UCS-2 LE BOM" encoding, while the DB2 command apparently only accepts files with UTF-8 encoding, and without the byte order mark. I'm actually not sure yet if that is the only format that DB2 accepts, or if it is related to which encoding the database in question is using.