I am getting wierd results reading a datetime year to fraction(3) from an
Informix IDS 7.30U C6 database. My code is compiled by VisualCafe 3
(JDK 1.1) and my tests were done in two machines:
- An HP-UX 10.20 server with JRE 1.1 and the Informix JDBC 1.5 JAR,
with TZ set to BRA3VER (GMT -2 at this moment)
- My Windows98 PC with VisualCafe's JRE 1.1 and the Informix JDBC
1.5 JAR set to Rio TimeZone with DST (GMT -2 at this moment)
The results, obtained executing the exact same .class file (source listed
further ahead) are:
Running on the HP-UX server:
Debug get, AWB: 2405604751, db TS: 2000-12-12 13:58:41.000 GMT,
long : 976629521000
Running on my PC:
Debug get, AWB: 2405604751, db TS: 2000-12-12 16:58:41.000 GMT,
long : 976640321000
In dbaccess this is what I get with statment select loguser, logdate from
shipser where awb = "2405604751" :
loguser logdate
pegadm 2000-12-12 11:58:41.180
SimpleDateFormat formatter =
(SimpleDateFormat) Sage.getDateFormatter().clone();
// Instruction above equal to
// new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z", Sage.STD_LOCALE);
// followed by a clone, where STD_LOCALE = Locale.US;
System.out.println("Debug AWB: " + awbNumber
+ ", db TS: " + formatter.format(dbTimeStamp)
+ ", long : " + dbTimeStamp.getTime());
/////////////// END OF CODE //////////////////
It seems that the JDBC driver is applying a GMT offset when it reads the
datetime... and a different offset depending on which machine the code is
executing. This does not make sense to me - the driver should not touch
the Date value. Am I missing something?
Bookmarks