Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Writing a Clob in Java

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the application I'm reviewing a clob is written like this:

- insert a row with an empty clob (with EMPTY_CLOB())
- select the clob-column with the empty clob to get the lob locator
- update the row to write the new clob with "meaningful" data

Now I'm told that performance is better when the lob locator is returned by the insert statement. I know that the syntax for the sql is like that:

insert into <table_name> (<attribute list> values(<attributes>,EMPTY_CLOB()) returning <clob column> into clob_selected;

Can anybody help me doing this in Java? I'd appreciate your help very much but don't be angry if I don't reply for hours on end. I'm in Germany and my working day is almost over...
 
Christa Koch
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to add that the difficult part for me is the returning clause.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THe performance will depend on the database. Are you using Oracle as the DB?

In Oracle, you may notice a performance benefit if you use the native Oracle Driver APIs to insert an empty clob first, and then update the CLOB afterwards.

However, in MySQL, inserting the CLOB directly may give you better performance.

Originally posted by Christa Koch:
In the application I'm reviewing a clob is written like this:

- insert a row with an empty clob (with EMPTY_CLOB())
- select the clob-column with the empty clob to get the lob locator
- update the row to write the new clob with "meaningful" data

Now I'm told that performance is better when the lob locator is returned by the insert statement. I know that the syntax for the sql is like that:

insert into <table_name> (<attribute list> values(<attributes>,EMPTY_CLOB()) returning <clob column> into clob_selected;

Can anybody help me doing this in Java? I'd appreciate your help very much but don't be angry if I don't reply for hours on end. I'm in Germany and my working day is almost over...

 
Christa Koch
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joseph, the database is Oracle.
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic