473,387 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Using Text File to Store User Data vs. Database

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
4 6920
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: James | last post by:
HI, I'm looking for a script that will allow users/admins to have a one click backup solution for a MYSQL Database.. 'BACK DATABASE' button, click and its done... The a restore option, that...
2
by: Sam | last post by:
I would like to store html templates in a database. By using perl I would like to retrive the template ask the user to fill the template and store the whole file is template + the user data in a...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
21
by: matvdl | last post by:
I have a system that was originally developed in asp - the pages are saved in SQL (there are over 10,000 pages) and saved to a temp directory in the server when requested by a client. I have...
2
by: garyusenet | last post by:
I could do with something similiar, can you tell me if you think this would work for me, and if there's any advantage in working with controls this way than how I currently am. At the moment...
13
by: JJ | last post by:
I have a need to input a large tab delimited text file, which I will parse to check it has the expected columns, before allowing the user to submit it to the database. The user may paste the file...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.