Solved

JSP question

Posted on 2002-07-13
2
200 Views
Last Modified: 2010-03-31
I am accessing a database with JSP.  Depending on the date on the server, I need to display the contents of a certain table within that database, (It will change weekly).  Any suggestions as to how I should approach this.

Thanks,
Mike
0
Comment
Question by:MichaelVB
2 Comments
 
LVL 3

Accepted Solution

by:
gandalf94305 earned 100 total points
ID: 7151654
Michael,
  your question is rather general, so I will try to answer in an equally general way :-).

I assume you have some database tables T1, T2, T3, T4, ... which have the same schema. The easiest way of selecting a table based on the current week would be to use a java.util.Calendar object to obtain the week of year (WEEK_OF_YEAR attribute), then either keep a mapping table to associate table names with weeks of the year, or to name the tables according to the weeks of the year. On the Oracle level, you could also define views, one for each week of the year to map to the actual tables.

The mapping table (either as Java properties, or as a database table) would be used if several weeks map to the same table. The naming convention or the views would be more suitable if there is a rather chaotic mapping, possibly with a new, different view every week.

Now it is up to you: if you prefer a Java solution (to be taken into account when the SQL statements will be built), use a properties-based mapping. If you prefer a database solution, try your luck with views in the database.

Ah, there is a third alternative: when a new week starts, reload the data into the appropriate tables, so the names of the tables will always be the same... but that did seem to be a bit too trivial to suggest.

If you need bits of code, let me know: gandalf94305@yahoo.com

Cheers,
--gandalf.
0
 

Author Comment

by:MichaelVB
ID: 7156416
Thanks for the suggestions.  I'll be in touch if I need some advice or clarification.

Mike
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoreUp challenge 14 48
return in catch statement 1 40
pairstar challenge 2 42
nestparen challenge 4 57
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now