Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
What is better flat file or database?

 
Post new topic   Reply to topic    dna88 Forum Index -> Databases Discussion Forum
Author Message
dude
Power User
Power User


Joined: 10 Mar 2004
Posts: 376
Location: Savar, Dhaka

Post Post subject: What is better flat file or database? Reply with quote

We can use flat files to save our data with delimitation and then retrieve it. Or we can use a database like MYSQL or MS ACCESS.What is better in what cases? Generally people use databases like MYSQL or MSACCESS, I think. But I also hear that flat file databases can be useful some times. Any idea my friends?
Mon Jul 12, 04 12:34 am
Back to top
dude View user's profile Send private message Visit poster's website
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Use flat file or a real database? Reply with quote

Well let us talk simple here and start from the beginning so that even a dummy can understand it. lol. Actually the explanantion below is mostly taken from an excerpt from the dummy web sete.

Flat files are text files stored in the computer file system. Humans can read flat files very easily by using the operating system commands that display files, such as cat in Linux and Unix or even notepad in windows! You can access and edit these files by using any text file editor, such as Notepad or vi. The information in the flat file is stored as strings, and the java, vb c and whatever program or PHP, asp, jsp or whatever server side script that retrieves the data needs to know how the data is stored. For example, to retrieve a customer name from a file, the PHP script needs to know that the customer name is stored in the first 20 characters of every line.

Using a database for data storage requires you to install and learn how to use database software, such as MySQL or Oracle. The data is stored in files created by the database software and can only be accessed by the database software. Databases can store very complex information that you can retrieve easily. You don't need to know how the data is stored, just how to interact with the database software. For example, to retrieve a customer name, a PHP script needs to know only how to tell the database software that it wants the customer name, using a standard communication language called SQL. The database software handles the storage and delivers the data, without the script needing to know exactly where or how the customer name is stored.

Flat files have some advantages over databases:

Flat files are available and versatile: You can create and save data in any operating system's file system. You don't need to install any extra software. Additionally, text data stored in flat files can be read by a variety of software programs, such as word processors or spreadsheets.

Easy to use: You don't need to do any extra preparation, such as install database software, design a database, create a database, and so on. Just create the file and store the data with statements in your PHP script.

Smaller: Flat files store data by using less disk space than databases.
A flat file is quick and easy and takes less space than a database. It is ideal for storing small amounts of information quickly, such as a simple list or small piece of information. Flat files are particularly useful for making information available to other software, such as an editing program or a spreadsheet. Flat files can be looked at by anyone with access to the computer directory where they are stored, so they are useful when information needs to be made available to other people.

DK once told me that yahoo still uses flat file for its primary database. That yahoo has always been using flat files from the beginning. It's hard to believe though. Who knows where he got that information!

Databases have some advantages as well:

Security: A database provides a security layer of its own, in addition to the security provided by the operating system. A database protects the data from outside intrusion better than a flat file.

Accessibility of data: You can store data in a database by using a very complex data structure, specifying data types and relationships among the data. The organization of the data makes it easy to search the data and retrieve what you need.

Ability to handle multiple users: When many users store or access data in a single file, such as a file containing names and addresses, a database ensures that users take their turn with the file to avoid overwriting each other's data.

Databases require more start-up effort and use more space than a flat file, but are much more suitable for handling complex information. The database handles the internal organization of the data, making data retrieval much simpler. A database provides more security, making it more suitable for sensitive, private information. Databases can more easily and efficiently handle high traffic when many users may try to access the data almost simultaneously.

In PHP 5, SQLite, an extension for data storage that combines the main advantages of flat files and databases, is included by default. SQLite stores the data in a flat file, so you don't need to install database software, but you store data using SQL, the standard database communication language. SQLite is a quick option for storing and retrieving small amounts of data in a flat file using SQL. SQLite is not a good option for really huge, complicated databases.

Also it has been rumored and I suppose it is true use that complicated flat file database that is accessed very actively causes system performance degradation severly.

So the choice is simple really, you can go with flat files for smaller projects. Larger projects go with mysql, ms access or oracle.
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Mon Jul 12, 04 11:15 am
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
hasnut
Expert User
Expert User


Joined: 28 Aug 2004
Posts: 201

Post Post subject: Re: What is better flat file or database? Reply with quote

dude wrote:
We can use flat files to save our data with delimitation and then retrieve it. Or we can use a database like MYSQL or MS ACCESS.What is better in what cases? Generally people use databases like MYSQL or MSACCESS, I think. But I also hear that flat file databases can be useful some times. Any idea my friends?


I used lots of flat files few years back with perl, also some old scripts use flat file db.

But,I think you should go for Actual Database.
_________________
Sarder Hasnut
MCSD, CIW A

Need Low Cost Prefessional Hosting Contact me
Fri Oct 22, 04 7:50 am
Back to top
hasnut View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Databases Discussion Forum All times are GMT - 7 Hours
Page 1 of 1

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group