Java DB rotation

A

Arne Vajhøj

I change my mind. The same poster made the same query on comp.lang.php
but said


I now hypothesize trolling.

It could be trolling.

Or he just want both a Java and a PHP view on things.

Out of curiosity: did the PHP folks answer similar to us?

Arne
 
C

Chris Riesbeck

It could be trolling.

Or he just want both a Java and a PHP view on things.

Out of curiosity: did the PHP folks answer similar to us?

The 1st responder asked "why not add a timestamp column?" and when the
OP said "because of REST," another responder said that wasn't a reason.
Other responses just tried to solve the problem. So similar but less
push-back than over here.
 
A

Arne Vajhøj

The 1st responder asked "why not add a timestamp column?" and when the
OP said "because of REST," another responder said that wasn't a reason.
Other responses just tried to solve the problem. So similar but less
push-back than over here.

The PHP group probably have a larger fraction of "hobby programmers"
than the Java group.

Arne
 
G

George Neuner

Java server will start read / write to a new DB table every
week/monday
e.g.
table-1-2-2012
table-1-9-2012
table-1-16-2012
table-1-23-2012 ... etc

I think of 2 ways to do the DB table rotation

1) check the server timestamp, if today's date is week of 1-23-2012,
then read/write to table-1-23-2012

2) have a unix cron job run every monday to generate a text file on
Java server with DB table named on that date - on each Java request,
check the text file's table name - then read/write to that DB table

any other solution to DB table rotation?

Others have already harped on the poor design ... so I'll just address
the question as asked.

1) You don't say what DBMS, but most workgroup and enterprise level
implementations include a built in task scheduler. You can create a
internal task that runs at a specific time to create new tables.

2) Since you are load balancing, you are (or should!) be using
replication to keep the database instances synchronized. If you are
doing online (hot) replication, then creating a new table on one
server will replicate it on the other servers within a minute or so.
If, OTOH, replication is periodic, you can kick start it after
creating the new table.

3) You can designate one server as a master and have it remotely
create tables on the other servers. This also can be done with a DBMS
task. Of course, this introduces failover issues, i.e. what to do if
the master DBMS instance is down.


Clients do not need to know about or participate in this table
rotation scheme at all. They can use the same table all the time.
Periodically the contents of the table can be copied into a dated
archive table and then the current use table can be emptied.

This is a simple 2 step transaction:

SELECT INTO <archival table> * FROM <current table>;
DELETE FROM <current table>;

George
 
R

Rajiv Gupta

I have a Java server controller that read/write to Database table

Java server will start read / write to a new DB table every
week/monday
e.g.
table-1-2-2012
table-1-9-2012
table-1-16-2012
table-1-23-2012 ... etc

I think of 2 ways to do the DB table rotation

1) check the server timestamp, if today's date is week of 1-23-2012,
then read/write to table-1-23-

2012

Sir, that sounds really really fucked up. Why not just one table?
Tables can store huge amounts of data efficiently.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,200
Latest member
LaraHunley

Latest Threads

Top