On 1/30/2012 9:23 PM, Jim Lee wrote:
> On Mon, 30 Jan 2012 21:20:14 -0500, Arne Vajh?j<>
> wrote:
>> On 1/30/2012 9:17 PM, Jim Lee wrote:
>>> On Mon, 30 Jan 2012 21:12:14 -0500, Arne Vajh?j<>
>>> wrote:
>>>
>>>> On 1/30/2012 9:08 PM, Jim Lee wrote:
>>>>> 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
>>>>>
>>>>> 2) have a unix corn 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?
>>>>>
>>>>> the first way check timestamp have a drawback when server's time is
>>>>> not set to correct time, since
>>>>>
>>>>> there are many Java server running for load balance, it's not a good
>>>>> idea.
>>>>>
>>>>> the second way is a better solution, but request additional setup -
>>>>> cron job
>>>>
>>>> I can not see any any problems with construction the table
>>>> name every time you need it.
>>>
>>> to construct the table name, i need to use the server timestamp, what
>>> if the server time is incorrect? then everything is messed up? On
>>> linux, is the server time always in sync with internet time server? or
>>> it's depended on the motherboard BIOS time?
>>
>> If you can not get the time correctly to construct a tablename
>> then you can not get the time correctly to write to the file.
>>
>> You can setup NTP to synch time.
>>
>> But does it matter if one server is 2 seconds off?
>
> 1-2 sec off is not matter
Synching time today is not difficult.
Arne
|