I have an .sql file with a few simple "Insert into" SQL commands that are being inserted into a table called Künstler.

insert into Künstler (name) values ('Mariah Carey');
insert into Künstler (name) values ('Michael Jackson');

However upon executing the file through Putty to run all these commands, each line is met with an error;

During SQL processing it returned:
SQL0007N The following on "insert into K" mark "▒" is invalid.

It seems the German umlaut characters are being transformed into '▒'

I have enabled UTF-8 on Putty and the commands will work if entered manually, but not as a batch. Is there any work around?

For extra information, the language I am using is DB2.

  • This is a very bad idea, to call the column "Künstler". I would consider, simple to rename the colomn. – duDE Jan 14 '16 at 15:49
  • @duDE Yeah I would do the same but unfortunately I don't have a choice in the matter :/ – Pejman Poh Jan 14 '16 at 15:54

Running a script in PuTTY is not affected by any of PuTTY's settings. It would only depend upon the encoding (character-set) of the script and your locale settings (as well as the database's encoding—and the way it reads scripts).

When you type on the keyboard using PuTTY, that depends on PuTTY's settings for the keyboard.

Rather than look for a fix in PuTTY, you might be able to set your application code page (mentioned in the DB2 reference) to UTF-8 (page 1208 according to Understanding DB2 Universal Database character conversion). According to Derivation of code page values, that should happen automatically if your locale is set properly.


Solution turned out to be rather simple. I was writing the script in notepad++ and I had set the file to the wrong encoding. Switching the encoding from the default ANSI to UTF-8 solved the issue.

This can be done through Encoding -> Encode in UTF-8 without BOM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.