Problem storing dates with JDBC

John Summerfield <summer@os2.ami.com.au>

From: John Summerfield <summer@OS2.ami.com.au>
To: pgsql-bugs@postgresql.org
Date: 1999-03-01T05:02:35Z
Lists: pgsql-bugs

Attachments



Your name		:John Summerfield	
Your email address	:summer@os2.ami.com.au


System Configuration
---------------------
  Architecture (example: Intel Pentium)  	:Intel Pentium

  Operating System (example: Linux 2.0.26 ELF) 	: 2.2.2 (client), 2.0.35
  (server)

  PostgreSQL version (example: PostgreSQL-6.3.2)  :   PostgreSQL-6.3.2

  Compiler used (example:  gcc 2.7.2)		:gcc 2.7.2

  java full version "Linux_JDK_1.1.7_v1a_green_threads
  
  I trust this is enough to identify the version of jdbc:
  [summer@possum data]$ jar -tv /usr/share/postgresql/postgresql.jar

[summer@possum data]$ jar -tvf /usr/share/postgresql/postgresql.jar
  3502 Sun Aug 02 15:25:58 GMT 1998 META-INF/MANIFEST.MF
  3430 Sun Aug 02 15:25:44 GMT 1998 postgresql/fastpath/Fastpath.class
  1019 Sun Aug 02 15:25:46 GMT 1998 postgresql/fastpath/FastpathArg.class
  1830 Stun Aug 02 15:25:48 GMT 1998 postgresql/geometric/PGbox.class
  2159 Sun Aug 02 15:25:50 GMT 1998 postgresql/geometric/PGpoint.class
  2064 Sun Aug 02 15:25:50 GMT 1998 postgresql/geometric/PGcircle.class
  1864 Sun Aug 02 15:25:52 GMT 1998 postgresql/geometric/PGlseg.class
  2289 Sun Aug 02 15:25:54 GMT 1998 postgresql/geometric/PGpath.class
  1703 Sun Aug 02 15:25:56 GMT 1998 postgresql/geometric/PGpolygon.class
  2355 Sun Aug 02 15:25:42 GMT 1998 postgresql/largeobject/LargeObjectManager.class
  2458 Sun Aug 02 15:25:42 GMT 1998 postgresql/largeobject/LargeObject.class
   998 Sun Aug 02 15:25:42 GMT 1998 postgresql/util/PGobject.class
 23314 Sun Aug 02 15:25:46 GMT 1998 postgresql/util/UnixCrypt.class
  2033 Sun Aug 02 15:25:50 GMT 1998 postgresql/util/PGtokenizer.class
  1663 Sun Aug 02 15:25:36 GMT 1998 postgresql/CallableStatement.class
  6540 Sun Aug 02 15:25:38 GMT 1998 postgresql/PreparedStatement.class
  2784 Sun Aug 02 15:25:38 GMT 1998 postgresql/Statement.class
 11121 Sun Aug 02 15:25:42 GMT 1998 postgresql/Connection.class
  9496 Sun Aug 02 15:25:44 GMT 1998 postgresql/ResultSet.class
  3675 Sun Aug 02 15:25:44 GMT 1998 postgresql/PG_Stream.class
  3684 Sun Aug 02 15:25:44 GMT 1998 postgresql/Driver.class
 20716 Sun Aug 02 15:25:46 GMT 1998 postgresql/DatabaseMetaData.class
  2967 Sun Aug 02 15:25:46 GMT 1998 postgresql/Field.class
  3164 Sun Aug 02 15:25:48 GMT 1998 postgresql/ResultSetMetaData.class
[summer@possum data]$ 



Please enter a FULL description of your problem:
------------------------------------------------
Dates, when retrieved, are advanced by one day from what was supposed to be
stored:

[summer@possum data]$ date;jikes  -g Checkpoint.java -d ~/Classes && jre mystocks.data.Checkpoint;echo select \* from tjs0103_checkpoints\; | psql sharetrader -h emu
Mon Mar  1 12:51:11 WST 1999
Mon Mar 01 04:51:12 GMT 1999
java.util.GregorianCalendar[time=920263872553,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=java.util.SimpleTimeZone[id=GMT,offset=0,dstSavings=3600000,useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,startTime=0,endMode=0,endMonth=0,endDay=0,endDayOfWeek=0,endTime=0],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=1999,MONTH=2,WEEK_OF_YEAR=10,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=60,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=4,HOUR_OF_DAY=4,MINUTE=51,SECOND=12,MILLISECOND=553,ZONE_OFFSET=0,DST_OFFSET=0]
1999
1
1999-03-01
select * from tjs0103_checkpoints;
      when|program   |programdata
----------+----------+-----------
03-02-1999|Checkpoint|           
(1 row)

EOF
[summer@possum data]$ 


Source code is attached.

Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible: 
----------------------------------------------------------------------
Customise the attached java program as needed & run it.




If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------



-- 
Cheers
John Summerfield
http://os2.ami.com.au/os2/ for OS/2 support.
Configuration, networking, combined IBM ftpsites index.