Solved

JSP question

Posted on 2002-07-13
2
205 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

Independent Software Vendors: 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

Title # Comments Views Activity
servlet filter example 37 83
Java program running SQL query 5 48
Cisco ASA: Java web start no go, asdm launcher no go 3 57
Java Eclipse Loop 3 29
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…
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…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

762 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