From: | Michael Stephenson <mstephenson(at)tirin(dot)openworld(dot)co(dot)uk> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | JDBC Large ResultSet problem + BadTimeStamp Patch |
Date: | 2000-10-11 15:52:07 |
Message-ID: | Pine.LNX.4.10.10010111630510.29625-100000@tirin.openworld.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-interfaces |
Two things.
Firstly, when dealing with a large ResultSet (about 120000 rows), I get a
null pointer exception on the line:
wasNullFlag = (this_row[columnIndex - 1] == null);
Whenever I call getString(), has anyone else had this? And does anybody
have a solution?
Secondly, I've not seen it mentioned on here but the jdbc driver will
sometimes throw a bad time stamp exception when you use getTimeStamp() on
times which have are accurate to more than a second, this is the patch we
use to fix it.
Hope it is of some use to somebody,
Michael Stephenson
*** src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java Fri May 12
20:54:22 2000
--- src/interfaces/jdbc/org/postgresql/jdbc2/ResultSetPatch.java
Mon Sep 25 15:36:46 2000
***************
*** 439,445 ****
if(s==null)
return null;
! SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd
HH:mm:sszzz");
try {
return new Timestamp(df.parse(s).getTime());
--- 439,456 ----
if(s==null)
return null;
! SimpleDateFormat df = null;
! if (s.length()>21 && s.indexOf('.') != -1) {
! df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSzzz");
! } else if (s.length()>19 && s.indexOf('.') == -1) {
! df = new SimpleDateFormat("yyyy-MM-dd HH:MM:sszzz");
! } else if (s.length()>19 && s.indexOf('.') != -1) {
! df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss.SS");
! } else if (s.length()>10 && s.length()<=18) {
! df = new SimpleDateFormat("yyyy-MM-dd HH:MM:ss");
! } else {
! df = new SimpleDateFormat("yyyy-MM-dd");
! }
try {
return new Timestamp(df.parse(s).getTime());
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Mount | 2000-10-11 16:11:41 | Re: JDBC Large ResultSet problem + BadTimeStamp Patch |
Previous Message | Tom Lane | 2000-10-11 15:15:54 | Re: Small patch to replace 'idle' by 'trans' if transaction is still open |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Mount | 2000-10-11 16:11:41 | Re: JDBC Large ResultSet problem + BadTimeStamp Patch |
Previous Message | Lamar Owen | 2000-10-11 03:17:56 | Re: [INTERFACES] Announcing PgSQL - a Python DB-API 2.0 compliant interface to PostgreSQL |