6

I'm trying to insert some rows in a DB2 table which has a CLOB column. The limit I found is that I cannot insert a String constant bigger than 32KB and I can't shorten it because it's a JSON String. I'm willing to use as it is returned from the web service (kind of mock service).

  1. I'm actually using DbVisualizer (free), that makes probably things harder I think.

  2. I'm reading the data from a Spring WebApp from which I can try eventually to create a batch to insert the rows reading the data from Files.

  3. I've tried to use the DB2 IMPORT and LOAD commands, but those aren't (of course) recognized as SQL command in the DB2 SQL commander.

Do you have any ideas on what I could have done wrong or what other options I have to insert this ROWS with String constant > 32KB?

jle
  • 686
  • 1
  • 8
  • 24
mmuca
  • 61
  • 5
  • What is your Db2-platform (what operating system runs the Db2-server)? What is your Db2 version? – mao Sep 03 '18 at 08:30
  • If your Db2-server runs on Linux or Unix or Windows, You can access Db2-commands (such as load, import , export) with some restrictions and provisos, from plain SQL via the stored procedure SYSPROC.ADMIN_CMD. Refer to the Db2 Knowledge centre for examples, this is a FAQ in stackoverflow. – mao Sep 03 '18 at 08:32
  • What is the column definition (in the DDL) for the target column? For Db2 for Linux/Unix/Windows, the longest CLOB string is 2,147,483,647 bytes, when the database is correctly configured. – mao Sep 03 '18 at 08:34
  • The problem is that the DB is stored and managed at our client's IT HQ and we don't get to know much about it. We're able to execute insert and update only in the lowest development environment of the 4 available and we have to ask for new tables through an excel template (no DDL given by us). Do you think using BLOB and serializing the String can be helpful to avoid the size limit of string constant? – mmuca Sep 03 '18 at 10:59
  • 1
    If you don't know and cannot learn about the database (and RDBMS) in which you are programming then you should not be working with it. Go and talk with the correct people at your client. This is not a matter for Stackoverflow. – mao Sep 03 '18 at 11:55
  • @mao you're right about it, I should know better about it and I will. But just to make things clear (because I don't want to be misunterstood) this DB is accessed by the FE only for a couple tables that are used to store cachable web properties (to render/enable components). Until now it all worked fine beacuse the Insert and Select statements were pretty simple, we don't usually try luck. The reason i asked is beacuse i was wondering if there was a workaround to make the insert through simple SQL statement that i wasn't aware of. I think this could have been a matter of Stackoverflow. – mmuca Sep 03 '18 at 13:26
  • That's all OK. But if you search, you can find SQL to determine the Db2 version, platform, and table DDL for the table, those are fundamental and all you need is a connection and relevant SELECT rights. If you lack relevant rights, you have to talk to the correct people. A correctly configured Db2 database can happily support CLOB strings up to 2,147,483,647 bytes for Linux/Unix/Windows Db2-servers. But stackoverflow cannot determine the basics for you. – mao Sep 03 '18 at 13:31

0 Answers0