• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MySqlText to String conversion

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

I came across a requirement where i have to store paragraphs of data (not huge maximum of 5 paragraphs) in database, i have kept the column as TEXT. while insertion every thing is going fine it is storing as paragraphs(saw that in database). but while retrieving it is trimming all the spaces between the paragraph's and giving it as a single string. i read somewhere that we have to get the text as CLOB i tried that but it is also not working. below is the code.



Clob descClob = rs.getClob(2);
String descString = descClob.getSubString(1, (int)descClob.length());
engArticle.setNewsDescription(descString);

Thanks a lot in advance.


Regards
Kranthi.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What character is being used to distinguish a paragraph? Also, where are you seeing it with the "paragraphs" removed? As a hint to move you in the right direction, possibly...

If you're storing the text in the database with a new line character and then trying to display that text on a web page, HTML doesn't know anything about new line characters unless they are in HTML format. The difference between



and



Or better yet



The first example will not render as you expect in HTML. The second 2 examples will.
 
kranthi devarapalem
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great! its Working !. Sorry for not giving the exact information but you have guessed what i need. Thanks A Lot.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic