Using Text File to Store User Data vs. Database

Discussion in 'ASP General' started by vunet.us@gmail.com, Jul 2, 2007.

  1. Guest

    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, 2007
    #1
    1. Advertising

  2. 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.
    Bob Barrows [MVP], Jul 2, 2007
    #2
    1. Advertising

  3. Guest

    On Jul 2, 10:39 am, "Bob Barrows [MVP]" <>
    wrote:
    > 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, 2007
    #3
  4. 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.
    Bob Barrows [MVP], Jul 2, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David
    Replies:
    2
    Views:
    421
    Roedy Green
    Jul 29, 2003
  2. Universal
    Replies:
    1
    Views:
    588
    Lionel B
    Apr 8, 2005
  3. Universal
    Replies:
    0
    Views:
    444
    Universal
    Apr 8, 2005
  4. Andy B
    Replies:
    0
    Views:
    454
    Andy B
    Jun 19, 2008
  5. sandhu
    Replies:
    1
    Views:
    758
    Alvin Bruney [MVP]
    May 17, 2007
Loading...

Share This Page