This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

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

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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");









 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!