Solved

JSP question

Posted on 2002-07-13
2
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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 …
Suggested Courses

759 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