Solved

JSP question

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

863 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

22 Experts available now in Live!

Get 1:1 Help Now