• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to convert a String to java.sql.Clob?

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I would like to convert a String variable to the java.sql.Clob datatype:
My code looks like this:
String streamHTML = (out.toString());
Clob outHTML = (Clob)streamHTML;
And of course, this code doesn't work. Hope you can help me.
Thanks a lot.
qionghua
 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having the same problem i wish i knew how to do that
what enviorment are you using?
 
qionghua yang
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Window NT with Informix database. How about you?
qionghua
 
Fred Abbot
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
windows NT visual Age for java and an oracle database
 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fred,
How are trying to insert/update oracle?
Can I see some code?
Dan
 
Daniel Dunleavy
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have either of you tried
getCharacterStream()
getAsciiStream()
???
Dan
 
Fred Abbot
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dan
my problem is i am using visual age for java and therefore do not hvae a handle on the result set
I wrote some code outside of VA and it works fine
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
create clob from string for Oracle

oracle.sql.CLOB tempclob = oracle.sql.CLOB.createTemporary(
// the connection used to
// create the clob
// has to be the same as is
// used for the update
updatestmt.getConnection(), false,
oracle.sql.CLOB.DURATION_SESSION);
String clobstring = "yourdata";
try {
tempclob.setString(1, clobstring);
} catch (SQLException ex2) {


}


for non Oracle

if you have original clob data from a select
java.sql.Clob c = (java.sql.Clob) orig;
c.setString(1, "yourdata");
updatestmt.setClob(updateindex, c);

if original clob data is null - don't use clob - just use
updatestmt.setObject(updateindex, "yourdata");









reply
    Bookmark Topic Watch Topic
  • New Topic