• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem while writing clob coulmn

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am facing below problem,

I want to write clob column with some data. I have am writing it by following two step process,

1) Write empty string into clob cloumn with the help of EMPTY_CLOB() method
2) Get the recently added clob object and then update it by using writer (Resultset.getCharacterOutputStream)

This works fine for Statement but in case of Preparedstatment used in #1 it behaves strangely

Actually I found that it is not getting recently added clob object. So I could not able to update the column and data remain in clob column is empty.

Note: In case of Preparedstatment I am using batch processing.

Thanks in advance!

Thanks,
Hemant

 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which database ?

Please post some code and related error / log messages if any
 
hemant Budhewar BamniBk
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:Which database ?

Please post some code and related error / log messages if any



Thanks for your reply.

Stack: Oracle10g, Weblogic/Tomcat, Linux/Windows

I will add code as well.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can follow these steps -> http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/clob10g/handlingclobsinoraclejdbc10g.html

Let us know if you have errors even after following that tutorial
 
hemant Budhewar BamniBk
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:You can follow these steps -> http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/clob10g/handlingclobsinoraclejdbc10g.html

Let us know if you have errors even after following that tutorial



I am sorry Deepak,

I have initially tried this code but I was getting problem while writing with help of pstmt.setString() for More than 4k characters.

In above case even if I use props.put("SetBigStringTryClob", "true"); still it says string literal too long.

So then I used the steps which I mentioned.

i.e.

Wrting Empty Clob first then updating with characterStream writer.

I read somewhere that SetBigStringTryClob flag works in case main not for web apps.

Please provide if you have any inputs.



 
hemant Budhewar BamniBk
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:You can follow these steps -> http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/clob10g/handlingclobsinoraclejdbc10g.html

Let us know if you have errors even after following that tutorial



Code Snippet to update:

CLOB clob = (CLOB) objResultSetP.getObject(1);

Writer writer = null;
try
{
writer = clob.getCharacterOutputStream();
writer.write(m_strValue);
writer.flush();
}
finally
{
try
{
if (writer != null)
writer.close();
}

 
hemant Budhewar BamniBk
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, can anybody havin answer for this?
reply
    Bookmark Topic Watch Topic
  • New Topic