Using Text File to Store User Data vs. Database
Using Text File to Store User Data vs. Database
am 02.07.2007 16:20:40 von vunet.us
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.
Re: Using Text File to Store User Data vs. Database
am 02.07.2007 16:39:21 von reb01501
vunet.us@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.
Re: Using Text File to Store User Data vs. Database
am 02.07.2007 17:14:44 von vunet.us
On Jul 2, 10:39 am, "Bob Barrows [MVP]"
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.
Re: Using Text File to Store User Data vs. Database
am 02.07.2007 17:25:49 von reb01501
vunet.us@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.
Re: Using Text File to Store User Data vs. Database
am 02.07.2007 19:20:28 von Jon Paal
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.
wrote in message news:1183386040.608995.284650@o61g2000hsh.googlegroups.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.
>