Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a CLOB(50000) field in a DB2 table, and verified it has correctly created with


...however I received the following error message even when only attempting to insert a 40,000 character string into the field:

 [IBM][CLI Driver][DB2/LINUXX8664] SQL0102N  The string constant beginning with
 "'''Testing Long Notes! Testing Long Notes! Testing Long Notes! Testing" is too long.  

'Testing Long Notes!' is just the string I repeated over and over in the HTML field in order to build the 40,000 string length. PHP script then processes the posted HTML form and attempts the SQL INSERT which is resulting in the error.

What am I missing here? Is there some other place a maximum field size is set that overrides the CLOB(50000) setting? Perhaps a configuration item to control field sizes?

I am relatively new to DB2 after a client required conversion from MySQL.

share|improve this question

closed as off topic by mdpc, Ward, Khaled, John Gardeniers, faker Dec 31 '12 at 10:09

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

might get better reception on the DBA SE. – mdpc Dec 31 '12 at 4:00

You need to use prepared statements instead of concatenating the values into the query yourself. This also applies to MySQL as a good practice -- prepared statements protect you against SQL injection.

DB2 will refuse to handle a raw query longer than 32,000 characters.

share|improve this answer

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