This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes approach to save/retrieve data into database when number of columns keep changing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "approach to save/retrieve data into database when number of columns keep changing" Watch "approach to save/retrieve data into database when number of columns keep changing" New topic
Author

approach to save/retrieve data into database when number of columns keep changing

ketan joshi
Greenhorn

Joined: Sep 25, 2005
Posts: 3
Hi ,
Thanks in advance for help

Specific requirement:
I have to create dynamic text input fields based on a number input which shall divide a given range
eg. Start date,end date will be provided and a number to divide this date range will be provided (all these 3 parameters could change later)

Based on current values (eg, start date of 1st Jan 2011 and end date of 31st December 2011 and monthly interval ),I will have 12 text input fields
in this case it will be entry for Jan,feb March,.....December

Now above values could change eg. start date of 1st Jan 2011 and end date of 31st May 2011( 6 months) and weekly interval , so I will have 6*4=24 columns 1st Jan to 7th Jan,7th Jan to 15th Jan ,15th to 22nd and 22nd to 31st and so on

While I can think of creating dynamic columns in terms of html,I was wondering how should I design my database to save these values
I mean the column count will keep changing based on input by user


In which direction I should think..Database or Java code

Thanks
Ketan

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

Your data model seems horribly wrong. Instead of grouping these values in extra columns, it would seem more logical to store them in extra rows instead.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: approach to save/retrieve data into database when number of columns keep changing
 
Similar Threads
How to get weeks for a particular year with Calendar object
Calendar problem
Gridlyaout
Issue with java.util.Calendar in java1.5 & above
Date in java