Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Inserting CLOB(URGENT)  RSS feed

 
ram mohan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
This is urgent.I badly need the advice
I have to fill a form and update that supplied information to a table.Some informations in that form is a very lenghthy paragraph.So I defined those coluumns in the table as CLOB.
In the case of strings
private String Address;
Address=new String(request.getParameter("Address").trim());
stmt.execute("INSERT INTO TEST (ADDRESS) VALUES ('"+Address+"');");
The problem is how to insert those CLOB columns in the above sql?
I am using INTERBASE Database
How I have planned is I will get those lengthy string into the servlet as a string.Thereafter I thought of convert it in such a way so that I can directly insert it into the CLOB table.
How to convert the lengthy string into CLOB in the servlet.
I think what I have planned is correct.If it is wrong please correct me.
Since this is urgent I really appreciate speedy response.
I will appreciate comprehensive answer with the correct code
Thanks in advance
[This message has been edited by ram mohan (edited December 29, 2000).]
 
paul sun
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds to use setAsciiStream() or setCharacterStream() of Statement methods.
 
ram mohan
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul.Your suggestion is excellent.I have succeeded
 
uma K
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing a similar insertion problem into a CLOB column in the Oracle database. If I use direct INSERT statement, the setAsciiStream works fine. But if I user stored procedure for INSERT, then it gives as Type mismatch error. The data type is declared as CLOB in the IN parameter of the stored procedure
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!