Tomcat startup issues

If the preceding error message is spewed up while starting tomcat then the resolution is to make sure of these three things:

  1. the scripts in the bin folder have execute permissions set.
  2. The CATALINA_HOME environment points to the right tomcat installation
  3. The JAVA_HOME is properly set.

Oracle date and Unix time

Unix time: It is the number of seconds that have elapsed since Jan 01, 1970 12:00 AM   UTC (Coordinated Universal Time). The Jan 01, 1970 12:00 AM is termed as the Epoch. Consequently the Epoch is translated to Unix time 0. Note that you would find “Unix time” and “Epoch time” to be used interchangeably in documentation and usage. Also note that Unix time does not take into account leap seconds. Lets explain this a little as we go along.

UTC: It is the primary time standard used across the world. Every year or two, a second is added to the UTC to allow for vagaries in the earth’s rotation to keep it withing 0.9 seconds of UT1 (Universal Time that is based on the earth’s rotation). UT is equivalent to GMT. All timezones are defined in terms of UTC.

The Java System.currentTimeInMillis() returns the Unix time in the granularity of milliseconds. Please note that all of this is dependent on the sensitivity of the underlying OS – whether it stores time in the granularity of milliseconds or not.

In Oracle, date is granular to seconds and therefore maps appropriately to the Unix time.

To get the current date in Oracle down to seconds:

To get number of days (in Unix time => in seconds) time since the Epoch:

Here, 2440588 => Julian day of 1/1/1970 (starts at 12 midnight or 12 AM or 00h) where Julian day is the number of days since January 1, 4712 BC (12 noon). So this implies the number of days in Epoch time multiplied to result in the number of seconds.

To get current time represented as Unix time:

You could always “round” the above to get rid of the decimal part:

select ROUND((SYSDATE-TO_DATE(‘19700101′, ‘yyyymmdd’))*86400) from dual;

If you truncate as above then you could use the following query to get more accurate results. Another way to do the above is to use this query:

This sums up the number of days since the Epoch in seconds and the number of seconds since midnight to return the current Unix time.