This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes To CLOB or BLOB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "To CLOB or BLOB?" Watch "To CLOB or BLOB?" New topic
Author

To CLOB or BLOB?

Nick Ueda
Ranch Hand

Joined: Jun 17, 2003
Posts: 40
Hello,
I am storing massive (>15,000) character StringBuffers (basically html files) into a mySQL database...I was wondering if it would be better to use a CLOB to store it in or to use a BLOB? I was thinking CLOB because
i could easily get it out of the database back to StringBuffer and use it in my java application.
Any thoughts would be much appreciated.
Thanks,
Nick Ueda
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
That's what CLOBs are for...
Just wondering what's the incentive for storing the whole HTML documents in the database instead of the more common combination of metadata in the database and raw HTML on disk?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Nick Ueda
Ranch Hand

Joined: Jun 17, 2003
Posts: 40
Lasse,
By saying metadata do you mean a "reference" to the raw html on disk?
And by saying raw html do you mean the actual html file?
I was just wanting to get these terms straight.
In reply to your question:
I don't know...storing the content in a StringBuffer is the first
thing I thought of. I bet the way you suggested could very well
be alot easier.
Thanks,
Nick Ueda
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
That's exactly what I meant. That's how most people have done it, based on what I've heard.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To CLOB or BLOB?
 
Similar Threads
setCLOB method
Using Apache's FileItem for Uploading Images
How to use oracle 9.2 driver for oracle817's CLOB?
How to convert an object into BLOB
Concatination 3 columns of VARCHAR2(4000) to return a ResultSet with one column