Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Using Text File to Store User Data vs. Database

Reply
Thread Tools

Using Text File to Store User Data vs. Database

 
 
vunet.us@gmail.com
Guest
Posts: n/a
 
      07-02-2007
I want to know if this practice is effective and secure:
I have been thinking about storing some data, which my users upload,
in text files rather than database, since often I do not know how much
information users submit for things like item description or images
URL paths. This information may be very short or very long. MS SQL
Server requires a maximum field length to be set. Thus, if user enters
5 characters into 5000 character field, a lot of space will be wasted.
On the other hand, the database reference would point to the text
files to read users' data and display it on page.
So, please, share your opinion or experience about this technique.
Thanks.

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      07-02-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I want to know if this practice is effective and secure:


It depends. If you will need multi-user updates of this text file, then
forget the idea and use a database.

> I have been thinking about storing some data, which my users upload,
> in text files rather than database, since often I do not know how much
> information users submit for things like item description or images
> URL paths. This information may be very short or very long. MS SQL
> Server requires a maximum field length to be set. Thus, if user enters
> 5 characters into 5000 character field, a lot of space will be wasted.


No it won't - not if you use a varchar or nvarchar datatype. Spaces are
only appended with char and nchar datatypes.
You also have the possibility of using a text datataype, which is
similar to the Memo datatype in Access. Personally, I would avoid this
if not needed (varchar datatype can hold up to 8000 characters).

> On the other hand, the database reference would point to the text
> files to read users' data and display it on page.
> So, please, share your opinion or experience about this technique.
> Thanks.


There is no need for it.
Problems include:
as stated earlier: concurrent, multi-user access to a text file is
impossible.
backups
keeping the database file references in sync with the file locations
role-based security is more diffiicult

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
 
vunet.us@gmail.com
Guest
Posts: n/a
 
      07-02-2007
On Jul 2, 10:39 am, "Bob Barrows [MVP]" <(E-Mail Removed)>
wrote:
> (E-Mail Removed) wrote:
> > I want to know if this practice is effective and secure:

>
> It depends. If you will need multi-user updates of this text file, then
> forget the idea and use a database.
>
> > I have been thinking about storing some data, which my users upload,
> > in text files rather than database, since often I do not know how much
> > information users submit for things like item description or images
> > URL paths. This information may be very short or very long. MS SQL
> > Server requires a maximum field length to be set. Thus, if user enters
> > 5 characters into 5000 character field, a lot of space will be wasted.

>
> No it won't - not if you use a varchar or nvarchar datatype. Spaces are
> only appended with char and nchar datatypes.
> You also have the possibility of using a text datataype, which is
> similar to the Memo datatype in Access. Personally, I would avoid this
> if not needed (varchar datatype can hold up to 8000 characters).
>
> > On the other hand, the database reference would point to the text
> > files to read users' data and display it on page.
> > So, please, share your opinion or experience about this technique.
> > Thanks.

>
> There is no need for it.
> Problems include:
> as stated earlier: concurrent, multi-user access to a text file is
> impossible.
> backups
> keeping the database file references in sync with the file locations
> role-based security is more diffiicult
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.


Thank you very much for important input.
So, you say that if I use data type varchar with 8000 characters and
user enters 4 characters in, all remaining 7996 characters will not be
stored and used by databse?
Is Memo datatype in Access the same thing as varchar in MSSQL DB?
Thanks.

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      07-02-2007
(E-Mail Removed) wrote:
> Thank you very much for important input.
> So, you say that if I use data type varchar with 8000 characters and
> user enters 4 characters in, all remaining 7996 characters will not be
> stored and used by databse?


I think that's exactly what I said.
Varchar columns use a couple extra bytes to store the number of
characters actually stored in each row.

> Is Memo datatype in Access the same thing as varchar in MSSQL DB?


No. As I said, the Text datatype in sql server is equivalent to the Memo
datatype in Access.

SQL Server varchar is similar to the Text datatype in Access.

You may find this helpful:
http://www.aspfaq.com/show.asp?id=2229

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
how can i store punjabi text in database. this text must be displayed in punjabi in the browser. sandhu ASP .Net Datagrid Control 1 05-17-2007 11:50 AM
store Images (or any Binary Data) to a SQL Server database using VC++ Universal C++ 1 04-08-2005 10:23 AM
where should i store my data: text file or a database? David Java 2 07-29-2003 12:11 AM



Advertisments