views:

39

answers:

3

Hi,

I'm developing an application via which one can send sms by directing it to sms server. My problem is I'm supposed to store the messages sent with date,time and also with the names of users to whom the message was sent. What should I use to save that? database Or I should think f 'serialization'? Later on I'll have to display the records containing names of the users and sms according to date and time at which it was sent.

Suggest me something. Thanks.

+1  A: 

A database is your best bet for those kind of records in my opinion. When you have dates, names, other data and the need to relate it, a RDBMS generally will work the best.

Xorlev
+2  A: 

It depends.

Database is all eggs in one basket and a bit more work to get the data in.

Writing the SMSs to a daily log file type format is much simpler and eggs in many daily files.

If you have to, often, produce fancy complicated reports then go database.

Or go log style now as you can always migrated your data and interface to database later if it becomes neccesary.

Getting your data into a db isn't significantly more work than logging to a a file and can, under certain circumstances, be less work. If this isn't the case for you, you might benefit from the practice.
David Lively
Supereme
To David Lively. I agree. Each to his/her own preference.
To Supriya Kale. A modern SQL database running on its own machine with decent disk space would be fine with your data. If you try and use a simplistic java in memory database then you might have problems. So readup on JDBC/ODBC and SQL. Its not difficult just a bit of learning.
+1  A: 

If you need to do any kind of querying of your records, the database will win out over a simple serialized-object file; I'd only use the latter approach if you only ever need all of your data at once.

If you want a simple, lightweight DB I'd suggest looking at SQLite, for small apps like what you're describing the convenience and ease-of-use are a major win over using a full-scale 'production' DB engine like MySQL or Postgres. See this answer for more on that.

tzaman

related questions