• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Conversion into SQL Result Clob from a String

 
Azrael Noor
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not using any prepared statement

i am using Simple Query

Query can take 4000 Characters of String at one time

I have data over 10 thousand characters

I take an array of 4000's and put query process in loop

I feel i am going on wrong side.

I tried to used Oracle Resultset before but unable to get result through it, i am unable to get any other example over Google search


I am using JDK 6, Oracle Database


 
Wendy Gibbons
Bartender
Posts: 1110
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
using the search
java sql insert clob oracle I found this:
http://stackoverflow.com/questions/5549450/java-how-to-insert-clob-into-oracle-database
 
Azrael Noor
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For All Examples i am getting the same

also got same before when i previously tried the, but due to time lapse i inserted logic mentioned in first post.



Could you please tell how to resolve this?




 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've described how I've implemented inserting BLOBs into Oracle database some time ago here:
http://www.coderanch.com/forums/posts/list/513175#2322695
http://www.coderanch.com/forums/posts/list/518509#2347822

It should be easy to modify it to store CLOBs instead of BLOBs, but if you still have problems, feel free to ask again. Note that this solution is Oracle specific. There should be a database-agnostic way to put LOBs into database, but I didn't need that yet so I've only used this (Oracle specific) one.
 
Azrael Noor
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am looking onto your example

i now picked OJDBC6 Jar file, i think i was using old one OBDBC14

Compiling Same code and error changed






If anyone get this please suggest
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change your sqlStr variable to this:

The "for update" clause will lock the row. It is necessary condition in Oracle to lock row before you modify the LOB; it is documented somewhere. It was not in my code, because there the row gets locked when it is updated.
 
Azrael Noor
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martin Martin Martin Martin





Thanks It work Successfully Now

JAR: OJDBC6
JDK: 1.6
Code:



Is their any other approach to achieve this?



 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome!

The approaches I posted before are very similar to what you've got now. There might be slight performance saving with them if you're uploading large CLOBs, or lots and lots of small ones. Otherwise it is probably not worth the hassle, if you're satisfied with your current solution.
 
Azrael Noor
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Present the data is appending to data which i am retrieving in first query.
Just looking around to empty CLOB object.

I will also look on your examples, and make through them too and ask you again on them, if any problem still persists
 
Azrael Noor
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Driver is working fine is updating data for 30 Thousand characters.

I am now implementing the above like this

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic