By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,734 Members | 832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,734 IT Pros & Developers. It's quick & easy.

Using Text File to Store User Data vs. Database

P: n/a
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.

Jul 2 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
vu******@gmail.com 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.
Jul 2 '07 #2

P: n/a
On Jul 2, 10:39 am, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
vunet...@gmail.com 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.

Jul 2 '07 #3

P: n/a
vu******@gmail.com 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.
Jul 2 '07 #4

P: n/a
you should know what users are uploading, set constraints. Don't leave yourself exposed to problems.

Databases are designed to store data. It's a good thing to use, and allows for manageble maintenance.

Create an upload page for users which will capture validated info and allow for images of specified length and type etc., store
images in folder(s), if there going to be many, and store the rest of the info in the database.

using the right field types will keep wasted space out of the discussion.

<vu******@gmail.comwrote in message news:11**********************@o61g2000hsh.googlegr oups.com...
>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.

Jul 2 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.