Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

to store text as VARCHAR or CLOB?

 
prakash chauhan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34680
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
prakash chauhan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic