aspose file tools*
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
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: To CLOB or BLOB?