This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Problem while writing clob coulmn

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
Hi, can anybody havin answer for this?
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!