Go Back   Coding Forum > Coding World > Java

Reply
 
LinkBack Thread Tools Display Modes
Old 02-01-2012, 01:30 AM   #21 (permalink)
Arne Vajhøj
Guest
 
Posts: n/a
Default Java DB rotation

On 1/31/2012 2:03 PM, Chris Riesbeck wrote:
> On 1/31/2012 12:57 PM, Chris Riesbeck wrote:
>> On 1/31/2012 1:38 AM, Robert Klemme wrote:
>>> On 31.01.2012 03:32, Arne Vajhøj wrote:
>>>> On 1/30/2012 9:24 PM, Jim Lee wrote:
>>>>> On Tue, 31 Jan 2012 02:21:11 +0000 (UTC), Martin Gregorie
>>>>> <martin@address-in-sig.invalid> wrote:
>>>>>> On Mon, 30 Jan 2012 18:08:04 -0800, Jim Lee wrote:
>>>>>>> I have a Java server controller that read/write to Database table
>>>>>>>

>> Pretty much every response from the OP has suggested either really bad
>> intra-team communication (distributed team?), or a system architect
>> angling for an appearance on the Daily WTF.

>
> I change my mind. The same poster made the same query on comp.lang.php
> but said
>
>> I have a PHP server controller thatl read/write to Database table
>>
>> PHP server will start read / write to a new DB table every week/monday

>
> 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

  Reply With Quote
Old 02-01-2012, 07:30 PM   #22 (permalink)
Chris Riesbeck
Guest
 
Posts: n/a
Default Java DB rotation

On 1/31/2012 7:32 PM, Arne Vajhøj wrote:
> On 1/31/2012 2:03 PM, Chris Riesbeck wrote:
>> On 1/31/2012 12:57 PM, Chris Riesbeck wrote:
>>> On 1/31/2012 1:38 AM, Robert Klemme wrote:
>>>> On 31.01.2012 03:32, Arne Vajhøj wrote:
>>>>> On 1/30/2012 9:24 PM, Jim Lee wrote:
>>>>>> On Tue, 31 Jan 2012 02:21:11 +0000 (UTC), Martin Gregorie
>>>>>> <martin@address-in-sig.invalid> wrote:
>>>>>>> On Mon, 30 Jan 2012 18:08:04 -0800, Jim Lee wrote:
>>>>>>>> I have a Java server controller that read/write to Database table
>>>>>>>>
>>> Pretty much every response from the OP has suggested either really bad
>>> intra-team communication (distributed team?), or a system architect
>>> angling for an appearance on the Daily WTF.

>>
>> I change my mind. The same poster made the same query on comp.lang.php
>> but said
>>
>>> I have a PHP server controller thatl read/write to Database table
>>>
>>> PHP server will start read / write to a new DB table every week/monday

>>
>> 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?
>


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.

  Reply With Quote
Old 02-01-2012, 11:30 PM   #23 (permalink)
Arne Vajhøj
Guest
 
Posts: n/a
Default Java DB rotation

On 2/1/2012 2:49 PM, Chris Riesbeck wrote:
> On 1/31/2012 7:32 PM, Arne Vajhøj wrote:
>> On 1/31/2012 2:03 PM, Chris Riesbeck wrote:
>>> On 1/31/2012 12:57 PM, Chris Riesbeck wrote:
>>>> On 1/31/2012 1:38 AM, Robert Klemme wrote:
>>>>> On 31.01.2012 03:32, Arne Vajhøj wrote:
>>>>>> On 1/30/2012 9:24 PM, Jim Lee wrote:
>>>>>>> On Tue, 31 Jan 2012 02:21:11 +0000 (UTC), Martin Gregorie
>>>>>>> <martin@address-in-sig.invalid> wrote:
>>>>>>>> On Mon, 30 Jan 2012 18:08:04 -0800, Jim Lee wrote:
>>>>>>>>> I have a Java server controller that read/write to Database table
>>>>>>>>>
>>>> Pretty much every response from the OP has suggested either really bad
>>>> intra-team communication (distributed team?), or a system architect
>>>> angling for an appearance on the Daily WTF.
>>>
>>> I change my mind. The same poster made the same query on comp.lang.php
>>> but said
>>>
>>>> I have a PHP server controller thatl read/write to Database table
>>>>
>>>> PHP server will start read / write to a new DB table every week/monday
>>>
>>> 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?
>>

>
> 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


  Reply With Quote
Old 02-02-2012, 06:30 PM   #24 (permalink)
George Neuner
Guest
 
Posts: n/a
Default Java DB rotation

On Mon, 30 Jan 2012 18:08:04 -0800, Jim Lee <jimlee2907@yahoo.com>
wrote:

>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
  Reply With Quote
Old 02-07-2012, 02:30 PM   #25 (permalink)
Rajiv Gupta
Guest
 
Posts: n/a
Default Java DB rotation

On 2012-01-31 13:08:04 +1100, Jim Lee said:

> 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.

  Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT. The time now is 01:22 AM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Copyright ©2010, CodingForum.Org