• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Writing a Clob in Java

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Joseph, the database is Oracle.
reply
    Bookmark Topic Watch Topic
  • New Topic