aspose file tools*
The moose likes JDBC and the fly likes to store text as   VARCHAR or CLOB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "to store text as   VARCHAR or CLOB?" Watch "to store text as   VARCHAR or CLOB?" New topic
Author

to store text as VARCHAR or CLOB?

prakash chauhan
Ranch Hand

Joined: Jun 22, 2007
Posts: 81
Hi ,
wanted to know lets which is better approach
to save text which could be upto 1000 characters as Varchar(1000) or using CLOB ?

like in javaranch are these posts saved as files in the database or as charcter oriented field?

-Thanks.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31062
    
232

Prakash,
What do you need to do with the data? In particular, if you want to search it using "like", varchar is better.

JavaRanch stores everything in files. It doesn't use a database.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
prakash chauhan
Ranch Hand

Joined: Jun 22, 2007
Posts: 81
Thanks..
I was trying to create a sort of BLOG , and was wondering how to tackle it.
Should i be creating a database with files (using clob) or should i save the posts as VARCHAR?
Blogs seems to be pretty complex things to implement so thats why confused.
-Thanks.
Paul Campbell
Ranch Hand

Joined: Oct 06, 2007
Posts: 338
Originally posted by prakash chauhan:
Thanks..
I was trying to create a sort of BLOG , and was wondering how to tackle it.
Should i be creating a database with files (using clob) or should i save the posts as VARCHAR?
Blogs seems to be pretty complex things to implement so thats why confused.
-Thanks.


You should think about how you want to organize the data first and how it will relate to each other before you worry about data types. At the moment you seem to be making an assumption that there is one column entry per blog... it doesn't necessarily have to be that way.
prakash chauhan
Ranch Hand

Joined: Jun 22, 2007
Posts: 81
well i have the ideas in my mind ,,
what i have thought i would go about it is like this..
I ll be needing three tables ,
one for users , one for quetions posted and one for answers.
each question posted will be saved in the questions table (primary key=QuestionID)and will have a user id to indicate who posted it ..
every answer will be a row in a table will be linked with its corressponding question by its QuestionID and again user who posted it.

now i can have queries to pull up answers to a questions or number of replies to a question and all that ..

now i came to know that javaracnch uses file and no database as such so how can we use files to save blog data without using a database?

Ideas i m having i know are blurry but thats possibly because i am still new and thats why just think of Jumping to Coding and try to bypass design consideration and all that..

-thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: to store text as VARCHAR or CLOB?