pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedResultSet.getDate
22+ messages / 9 participants
[nested] [flat]
* ResultSet.getDate
@ 1999-01-31 06:31 Peter Garner <peter_garner@yahoo.com>
1999-02-01 08:57 ` Re: [INTERFACES] ResultSet.getDate Urban Widmark <urban@svenskatest.se>
1999-02-01 13:46 ` Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
0 siblings, 2 replies; 22+ messages in thread
From: Peter Garner @ 1999-01-31 06:31 UTC (permalink / raw)
To: webmaster@retep.org.uk; +Cc: pgsql-interfaces
Hi Peter! ;-)
I think I may have found a problem in the postgres
JDBC driver V6.4. (BTW I assume the one I build from
the released source in postgresql-6.4.2.tar.gz is the
same as the jdbc6.4.jar downloadable from your web site
at http://www.retep.org.uk/postgres ? In anycase, the
problem seems to occur with both.)
Anyway I get an SQLException (well a parse exception,
really), when attempting to use the ResultSet.getDate
methods. The exception messages are (I omitted the
portions of the stack trace through my code):
Bad Date Format: at 0 in Fri Jan 29 04:29:50 1999 UTC
at postgresql.ResultSet.getDate(ResultSet.java:408)
Indeed, "Fri Jan 29 04:29:50 1999 UTC" is how dates are
output from my postgres databases. I am useing Redhat
5.2 and postgres built from the above mentioned source
file. The date format that is being selected for the
date formatter (ResultSet.java, line #403) is
"MM-dd-yyyy"
Which is of course not what postgres sends. Also, in
looking at this code, it seems that the time portion
is being thrown away in ResultSet.getDate, I am not
sure if this is what is intended from looking at the
JDBC API documentation published by Sun.
==
Peace,
Peter
We are Microsoft of Borg, you will be assimilated!!!
Resistance is fut... ***BZZZRT*** THUD!!!
[General Protection Fault in MSBorg32.DLL]
Please contact the vendor for more information
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] ResultSet.getDate
1999-01-31 06:31 ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
@ 1999-02-01 08:57 ` Urban Widmark <urban@svenskatest.se>
1 sibling, 0 replies; 22+ messages in thread
From: Urban Widmark @ 1999-02-01 08:57 UTC (permalink / raw)
To: Peter Garner <peter_garner@yahoo.com>; +Cc: webmaster@retep.org.uk; pgsql-interfaces
On Sat, 30 Jan 1999, Peter Garner wrote:
> Bad Date Format: at 0 in Fri Jan 29 04:29:50 1999 UTC
> at postgresql.ResultSet.getDate(ResultSet.java:408)
>
I've seen almost the same thing, using v6.4.2. I use timestamps and not
datetime as you in your next mail said you did (wow, I can see the future
:)
For me the problem is in the SimpleDateFormat class that doesn't recognize
the timezone value returned by the database (CET?). This may be a java bug
in the linux port, a timezone setting problem, ... I made a simple
workaround, that doesn't depend on timezone names. I haven't had time to
test it properly yet, see below.
If I remember correctly removing LC_CTYPE also made the conversion work
(but that may have been for my testprogram only).
> Indeed, "Fri Jan 29 04:29:50 1999 UTC" is how dates are
> output from my postgres databases. I am useing Redhat
> 5.2 and postgres built from the above mentioned source
> file. The date format that is being selected for the
> date formatter (ResultSet.java, line #403) is
>
> "MM-dd-yyyy"
>
> Which is of course not what postgres sends. Also, in
> looking at this code, it seems that the time portion
> is being thrown away in ResultSet.getDate, I am not
> sure if this is what is intended from looking at the
> JDBC API documentation published by Sun.
>
In Timestamps date and time is returned. Here is my changed getTimestamp
that uses GMT+hh:mm for the timezone.
public Timestamp getTimestamp(int columnIndex) throws SQLException
{
String s = getString(columnIndex);
if(s == null)
return null; // SQL NULL
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzz");
int TZ = new Float(s.substring(19)).intValue();
//BUG: negative values?
String nm = "GMT+" + TZ +":00"; // use GMT+hh:mm format
s = s.substring(0,19) + nm;
try {
java.util.Date d = df.parse(s);
return new Timestamp(d.getTime());
} catch (ParseException e) {
e.printStackTrace();
throw new SQLException("Bad Timestamp Format: at " + e.getErrorOffset() + " in " + s);
}
}
It is obviously not correct for negative TZ. Also it uses the timezone of
the value returned by the database and I don't know if that is different
from the clients timezone. Therefore I haven't sent it anywhere before.
Before you convert to timestamp, you should know that min() and max() is
not implemented for timestamps (or?), so you'll need to create the proper
aggregate functions. (Ask and I'll send the ones I made)
/Urban
---
Urban Widmark urban@svenskatest.se
Svenska Test AB +46 90 71 71 23
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: ResultSet.getDate
1999-01-31 06:31 ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
@ 1999-02-01 13:46 ` Peter T Mount <peter@retep.org.uk>
1999-02-01 15:21 ` Re: [INTERFACES] Re: ResultSet.getDate Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1 sibling, 1 reply; 22+ messages in thread
From: Peter T Mount @ 1999-02-01 13:46 UTC (permalink / raw)
To: Peter Garner <peter_garner@yahoo.com>; +Cc: webmaster@retep.org.uk; pgsql-interfaces
On Sat, 30 Jan 1999, Peter Garner wrote:
> Hi Peter! ;-)
>
> I think I may have found a problem in the postgres
> JDBC driver V6.4. (BTW I assume the one I build from
> the released source in postgresql-6.4.2.tar.gz is the
> same as the jdbc6.4.jar downloadable from your web site
> at http://www.retep.org.uk/postgres ? In anycase, the
> problem seems to occur with both.)
>
> Anyway I get an SQLException (well a parse exception,
> really), when attempting to use the ResultSet.getDate
> methods. The exception messages are (I omitted the
> portions of the stack trace through my code):
>
> Bad Date Format: at 0 in Fri Jan 29 04:29:50 1999 UTC
> at postgresql.ResultSet.getDate(ResultSet.java:408)
>
> Indeed, "Fri Jan 29 04:29:50 1999 UTC" is how dates are
> output from my postgres databases. I am useing Redhat
> 5.2 and postgres built from the above mentioned source
> file. The date format that is being selected for the
> date formatter (ResultSet.java, line #403) is
>
> "MM-dd-yyyy"
>
> Which is of course not what postgres sends. Also, in
> looking at this code, it seems that the time portion
> is being thrown away in ResultSet.getDate, I am not
> sure if this is what is intended from looking at the
> JDBC API documentation published by Sun.
I'll check, but what version of the JDK/JRE are you using? The
java.util.Date class was broken in pre jdk1.1.6 VM's.
I am thinking on re-working the date handling for PostgreSQL 6.5, as I'm
still seeing problems with them.
Peter
--
Peter T Mount peter@retep.org.uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] Re: ResultSet.getDate
1999-01-31 06:31 ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-01 13:46 ` Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
@ 1999-02-01 15:21 ` Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-01 16:42 ` Re: [INTERFACES] Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
0 siblings, 1 reply; 22+ messages in thread
From: Thomas G. Lockhart @ 1999-02-01 15:21 UTC (permalink / raw)
To: Peter T Mount <peter@retep.org.uk>; +Cc: Peter Garner <peter_garner@yahoo.com>; webmaster@retep.org.uk; pgsql-interfaces
> I am thinking on re-working the date handling for PostgreSQL 6.5, as
> I'm still seeing problems with them.
Anything we should consider doing on the server side to help??
- Tom
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] Re: ResultSet.getDate
1999-01-31 06:31 ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-01 13:46 ` Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
1999-02-01 15:21 ` Re: [INTERFACES] Re: ResultSet.getDate Thomas G. Lockhart <lockhart@alumni.caltech.edu>
@ 1999-02-01 16:42 ` Peter T Mount <peter@retep.org.uk>
1999-02-01 17:30 ` Re: [INTERFACES] Re: ResultSet.getDate Thomas G. Lockhart <lockhart@alumni.caltech.edu>
0 siblings, 1 reply; 22+ messages in thread
From: Peter T Mount @ 1999-02-01 16:42 UTC (permalink / raw)
To: Thomas G. Lockhart <lockhart@alumni.caltech.edu>; +Cc: Peter Garner <peter_garner@yahoo.com>; pgsql-interfaces
On Mon, 1 Feb 1999, Thomas G. Lockhart wrote:
> > I am thinking on re-working the date handling for PostgreSQL 6.5, as
> > I'm still seeing problems with them.
>
> Anything we should consider doing on the server side to help??
Not sure. The first thing I'm thinking of, is removing the datestyle
support, and having the driver set a datestyle to one (probably ISO)
during the connect. AFAIK, the ODBC driver uses a similar scheme?
This should reduce the size of the driver a little, and remove the number
of places where this error could occur.
If we still have problems, how about an internal datestyle for use by
interfaces only (like JDBC & ODBC)?
Peter
--
Peter T Mount peter@retep.org.uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] Re: ResultSet.getDate
1999-01-31 06:31 ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-01 13:46 ` Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
1999-02-01 15:21 ` Re: [INTERFACES] Re: ResultSet.getDate Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-01 16:42 ` Re: [INTERFACES] Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
@ 1999-02-01 17:30 ` Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-01 19:16 ` Re: [INTERFACES] Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
0 siblings, 1 reply; 22+ messages in thread
From: Thomas G. Lockhart @ 1999-02-01 17:30 UTC (permalink / raw)
To: Peter T Mount <peter@retep.org.uk>; +Cc: Peter Garner <peter_garner@yahoo.com>; pgsql-interfaces
> Not sure. The first thing I'm thinking of, is removing the datestyle
> support, and having the driver set a datestyle to one (probably ISO)
> during the connect. AFAIK, the ODBC driver uses a similar scheme?
Yes, sorry, I'd forgotten that you don't already do this. The ODBC
driver does force the date format to ISO.
> If we still have problems, how about an internal datestyle for use by
> interfaces only (like JDBC & ODBC)?
Sure, though the ISO style is pretty well defined and parsable, so may
be the best choice for an ASCII internal format.
- Tom
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] Re: ResultSet.getDate
1999-01-31 06:31 ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-01 13:46 ` Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
1999-02-01 15:21 ` Re: [INTERFACES] Re: ResultSet.getDate Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-01 16:42 ` Re: [INTERFACES] Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
1999-02-01 17:30 ` Re: [INTERFACES] Re: ResultSet.getDate Thomas G. Lockhart <lockhart@alumni.caltech.edu>
@ 1999-02-01 19:16 ` Peter T Mount <peter@retep.org.uk>
0 siblings, 0 replies; 22+ messages in thread
From: Peter T Mount @ 1999-02-01 19:16 UTC (permalink / raw)
To: Thomas G. Lockhart <lockhart@alumni.caltech.edu>; +Cc: Peter Garner <peter_garner@yahoo.com>; pgsql-interfaces
On Mon, 1 Feb 1999, Thomas G. Lockhart wrote:
> > Not sure. The first thing I'm thinking of, is removing the datestyle
> > support, and having the driver set a datestyle to one (probably ISO)
> > during the connect. AFAIK, the ODBC driver uses a similar scheme?
>
> Yes, sorry, I'd forgotten that you don't already do this. The ODBC
> driver does force the date format to ISO.
>
> > If we still have problems, how about an internal datestyle for use by
> > interfaces only (like JDBC & ODBC)?
>
> Sure, though the ISO style is pretty well defined and parsable, so may
> be the best choice for an ASCII internal format.
This is probably the way I will go.
Peter
--
Peter T Mount peter@retep.org.uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: ResultSet.getDate
@ 1999-01-31 06:36 Peter Garner <peter_garner@yahoo.com>
0 siblings, 0 replies; 22+ messages in thread
From: Peter Garner @ 1999-01-31 06:36 UTC (permalink / raw)
To: webmaster@retep.org.uk; +Cc: pgsql-interfaces
Hi again! :-)
Please accept my apologies, I forgot to mention that
the TYPE of the field the table in question is
"DATETIME"!
> I think I may have found a problem in the postgres
> JDBC driver V6.4. (BTW I assume the one I build from
==
Peace,
Peter
We are Microsoft of Borg, you will be assimilated!!!
Resistance is fut... ***BZZZRT*** THUD!!!
[General Protection Fault in MSBorg32.DLL]
Please contact the vendor for more information
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: ResultSet.getDate
@ 1999-02-01 21:43 Peter Garner <peter_garner@yahoo.com>
1999-02-02 04:39 ` Re: [INTERFACES] Re: ResultSet.getDate Aleksey Demakov <avd@gcom.ru>
0 siblings, 1 reply; 22+ messages in thread
From: Peter Garner @ 1999-02-01 21:43 UTC (permalink / raw)
To: Peter T Mount <peter@retep.org.uk>; +Cc: pgsql-interfaces
Hi Peter! ;-)
>I'll check, but what version of the JDK/JRE are you
>using? The java.util.Date class was broken in pre
>jdk1.1.6 VM's.
I am using the JDK 1.1.7v1a from Blackdown. Indeed,
Java's handling of dates is a little funky. But in
this case the problem is that the returned strings
are not being handled properly. Calling getString
instead of getDate returns :
"Mon Feb 01 16:08:00 1999 UTC"
And the format string used in the SimpleDateFormatter
object that getDate uses to convert that string is
not correct for that format. If there is anything I
can do to help, please let me know! :-)
==
Peace,
Peter
We are Microsoft of Borg, you will be assimilated!!!
Resistance is fut... ***BZZZRT*** THUD!!!
[General Protection Fault in MSBorg32.DLL]
Please contact the vendor for more information
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] Re: ResultSet.getDate
1999-02-01 21:43 Re: ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
@ 1999-02-02 04:39 ` Aleksey Demakov <avd@gcom.ru>
1999-02-05 06:56 ` Re: [INTERFACES] Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
0 siblings, 1 reply; 22+ messages in thread
From: Aleksey Demakov @ 1999-02-02 04:39 UTC (permalink / raw)
To: pgsql-interfaces
Peter Garner <peter_garner@yahoo.com> writes:
> I am using the JDK 1.1.7v1a from Blackdown. Indeed,
> Java's handling of dates is a little funky. But in
> this case the problem is that the returned strings
> are not being handled properly. Calling getString
> instead of getDate returns :
>
> "Mon Feb 01 16:08:00 1999 UTC"
>
> And the format string used in the SimpleDateFormatter
> object that getDate uses to convert that string is
> not correct for that format. If there is anything I
> can do to help, please let me know! :-)
Perhaps opening your connections as follows might help you
...
// open connection
conn = DriverManager.getConnection (url, usr, pwd);
// set datestyle
Statement st = conn.createStatement ();
st.executeUpdate ("set datestyle='iso'");
st.executeUpdate ("show datestyle");
st.close ();
...
--
Aleksey Demakov
avd@gcom.ru
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] Re: ResultSet.getDate
1999-02-01 21:43 Re: ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-02 04:39 ` Re: [INTERFACES] Re: ResultSet.getDate Aleksey Demakov <avd@gcom.ru>
@ 1999-02-05 06:56 ` Peter T Mount <peter@retep.org.uk>
0 siblings, 0 replies; 22+ messages in thread
From: Peter T Mount @ 1999-02-05 06:56 UTC (permalink / raw)
To: Aleksey Demakov <avd@gcom.ru>; +Cc: pgsql-interfaces
On 2 Feb 1999, Aleksey Demakov wrote:
> Peter Garner <peter_garner@yahoo.com> writes:
>
> > I am using the JDK 1.1.7v1a from Blackdown. Indeed,
> > Java's handling of dates is a little funky. But in
> > this case the problem is that the returned strings
> > are not being handled properly. Calling getString
> > instead of getDate returns :
> >
> > "Mon Feb 01 16:08:00 1999 UTC"
> >
> > And the format string used in the SimpleDateFormatter
> > object that getDate uses to convert that string is
> > not correct for that format. If there is anything I
> > can do to help, please let me know! :-)
>
> Perhaps opening your connections as follows might help you
>
> ...
> // open connection
> conn = DriverManager.getConnection (url, usr, pwd);
>
> // set datestyle
> Statement st = conn.createStatement ();
> st.executeUpdate ("set datestyle='iso'");
> st.executeUpdate ("show datestyle");
> st.close ();
I'm thinking on doing this within the driver, forcing it to use iso all
the time.
Peter
--
Peter T Mount peter@retep.org.uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] Re: ResultSet.getDate
@ 1999-02-01 22:16 Peter Garner <peter_garner@yahoo.com>
0 siblings, 0 replies; 22+ messages in thread
From: Peter Garner @ 1999-02-01 22:16 UTC (permalink / raw)
To: Peter T Mount <peter@retep.org.uk>; Thomas G. Lockhart <lockhart@alumni.caltech.edu>; +Cc: pgsql-interfaces
Hi All! :-)
Here is an even better one for you! ;-) It seems that
Java, not JDBC is chopping the time portion in doing
the conversion from a java.util.Date to a java.sql.Date
(ResultSet.getDate converts them) Try the following,
please :
import java.sql.* ;
import java.text.* ;
import java.util.* ;
class DateTest
{
// Public Methods
public static void main ( String strgarrArgs [] )
{
try
{
SimpleDateFormat sdf = new SimpleDateFormat ( "dd MMM yyyy
HH:mm:ss" ) ;
java.util.Date date = new java.util.Date ( "01 Feb 1999
16:08:00" ) ;
System.out.println ( "\nDate is:\t" + sdf.format ( date ) ) ;
java.sql.Date sqldate = new java.sql.Date ( date.getTime ()
) ;
System.out.println ( "SQL Date is:\t" + sdf.format ( sqldate )
+ "\n" ) ;
} /* endtry */
catch ( Exception e )
{
System.out.println ( "\nCaught an Exception of type " +
e.getClass ().getName () ) ;
System.out.println ( e.getMessage () ) ;
} /* endcatch */
} /* static void main ( String strgarrArgs [] ) */
} /* class DateTest */
On my machine at least the output is :
Date is: 01 Feb 1999 16:08:00
SQL Date is: 01 Feb 1999 00:00:00
Looks like a definite bug in the JVM or just in the
Blackdown Linux v1.17 JVM! ;-) Thanks again!
==
Peace,
Peter
We are Microsoft of Borg, you will be assimilated!!!
Resistance is fut... ***BZZZRT*** THUD!!!
[General Protection Fault in MSBorg32.DLL]
Please contact the vendor for more information
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] Re: ResultSet.getDate
@ 1999-02-02 06:23 Peter Garner <peter_garner@yahoo.com>
1999-02-05 06:55 ` Re: [INTERFACES] Re: ResultSet.getDate Peter T Mount <peter@retep.org.uk>
0 siblings, 1 reply; 22+ messages in thread
From: Peter Garner @ 1999-02-02 06:23 UTC (permalink / raw)
To: Aleksey Demakov <avd@gcom.ru>; pgsql-interfaces; +Cc: peter@retep.uk.org
Hi Aleksey! :-)
---Aleksey Demakov <avd@gcom.ru> wrote:
> st.executeUpdate ("set datestyle='iso'");
Thanks! :-) That ALMOST does it! ;-) Oddly, my
machine outputs dates as UTC (universal time clock) but
java wants to see GMT! From what I am reading in some
of the Java usenet groups, Sun has some real problems
trying to make their date classes totally locale
portable and they have a few bugs! ;-)
Speaking of bugs, Peter, check out line 460 in
ResultSet.java. You take the substring at from 0 to
18, I think you may want to take it from 0 to 19.
Thanks guys! ;-)
==
Peace,
Peter
We are Microsoft of Borg, you will be assimilated!!!
Resistance is fut... ***BZZZRT*** THUD!!!
[General Protection Fault in MSBorg32.DLL]
Please contact the vendor for more information
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] Re: ResultSet.getDate
1999-02-02 06:23 Re: [INTERFACES] Re: ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
@ 1999-02-05 06:55 ` Peter T Mount <peter@retep.org.uk>
0 siblings, 0 replies; 22+ messages in thread
From: Peter T Mount @ 1999-02-05 06:55 UTC (permalink / raw)
To: Peter Garner <peter_garner@yahoo.com>; +Cc: Aleksey Demakov <avd@gcom.ru>; pgsql-interfaces; peter@retep.uk.org
On Mon, 1 Feb 1999, Peter Garner wrote:
> Hi Aleksey! :-)
>
> ---Aleksey Demakov <avd@gcom.ru> wrote:
> > st.executeUpdate ("set datestyle='iso'");
>
> Thanks! :-) That ALMOST does it! ;-) Oddly, my
> machine outputs dates as UTC (universal time clock) but
> java wants to see GMT! From what I am reading in some
> of the Java usenet groups, Sun has some real problems
> trying to make their date classes totally locale
> portable and they have a few bugs! ;-)
>
> Speaking of bugs, Peter, check out line 460 in
> ResultSet.java. You take the substring at from 0 to
> 18, I think you may want to take it from 0 to 19.
> Thanks guys! ;-)
Will do.
> ==
> Peace,
> Peter
>
> We are Microsoft of Borg, you will be assimilated!!!
> Resistance is fut... ***BZZZRT*** THUD!!!
> [General Protection Fault in MSBorg32.DLL]
> Please contact the vendor for more information
> _________________________________________________________
> DO YOU YAHOO!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
--
Peter T Mount peter@retep.org.uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
^ permalink raw reply [nested|flat] 22+ messages in thread
* ResultSet.getDate
@ 1999-09-22 12:33 Tim Joyce <tim@hoop.co.uk>
0 siblings, 0 replies; 22+ messages in thread
From: Tim Joyce @ 1999-09-22 12:33 UTC (permalink / raw)
To: pgsql-interfaces
Hi,
I am using JDBC, everything is fine on local boxes (GMT), but we have just
installed our system on a box in the states (EST)
I am getting
java.sql.SQLException: Bad Timestamp Format: at 0 in 1999-07-31 20:00:0EST
thrown by ResultSet
Running Postgresql 6.4.2 on RH Linux 2.0.33
is there a fix or a workarround?
Cheers
Tim Joyce
Chief Enthusiast
tim@hoop.co.uk
HOOP Ltd
http://www.hoop.co.uk
01202 251 816
HOOP is proud to be a member of the Paneris community (www.paneris.co.uk)
^ permalink raw reply [nested|flat] 22+ messages in thread
* ResultSet.getDate
@ 1999-09-22 14:08 Tim Joyce <tim@hoop.co.uk>
1999-09-23 06:21 ` Re: [INTERFACES] ResultSet.getDate Peter Mount <peter@retep.org.uk>
0 siblings, 1 reply; 22+ messages in thread
From: Tim Joyce @ 1999-09-22 14:08 UTC (permalink / raw)
To: pgsql-interfaces
Hi,
I am using JDBC, everything is fine on local boxes (GMT), but we have just
installed our system on a box in the states (EST)
I am getting
java.sql.SQLException: Bad Timestamp Format: at 0 in 1999-07-31 20:00:0EST
thrown by ResultSet
Running Postgresql 6.4.2 on RH Linux 2.0.33
is there a fix or a workarround?
Cheers
Tim Joyce
Chief Enthusiast
tim@hoop.co.uk
HOOP Ltd
http://www.hoop.co.uk
01202 251 816
HOOP is proud to be a member of the Paneris community (www.paneris.co.uk)
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] ResultSet.getDate
1999-09-22 14:08 ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
@ 1999-09-23 06:21 ` Peter Mount <peter@retep.org.uk>
0 siblings, 0 replies; 22+ messages in thread
From: Peter Mount @ 1999-09-23 06:21 UTC (permalink / raw)
To: Tim Joyce <tim@hoop.co.uk>; +Cc: pgsql-interfaces
On Wed, 22 Sep 1999, Tim Joyce wrote:
> Hi,
>
> I am using JDBC, everything is fine on local boxes (GMT), but we have just
> installed our system on a box in the states (EST)
>
> I am getting
>
> java.sql.SQLException: Bad Timestamp Format: at 0 in 1999-07-31 20:00:0EST
>
> thrown by ResultSet
>
> Running Postgresql 6.4.2 on RH Linux 2.0.33
>
> is there a fix or a workarround?
The date and time methods are being rewritten for 6.6 as they can't handle
some of the different time zones.
Peter
--
Peter T Mount peter@retep.org.uk
Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
Java PDF Generator: http://www.retep.org.uk/pdf
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] ResultSet.getDate
@ 1999-11-15 11:29 Tim Joyce <tim@hoop.co.uk>
1999-11-15 14:29 ` Re: [INTERFACES] ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
1999-11-15 15:00 ` Re: [INTERFACES] ResultSet.getDate Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 22+ messages in thread
From: Tim Joyce @ 1999-11-15 11:29 UTC (permalink / raw)
To: Peter Mount <peter@retep.org.uk>; paneris messageboard <paneris@messageboards.paneris.org>; pgsql-interfaces
> > Peter,
> >
> > >The date and time methods are being rewritten for 6.6 as they can't
handle
> > >some of the different time zones.
> >
> > Thanks, can I set postgres to pass dates to JDBC in a format that it can
> > understand?
>
> The SET DATESTYLE statement can be used to force the backend to return
> dates in a particular format. The best one being ISO.
This problem is still causing me headaches, I can change the timezone for
the session:
finsbury=> select current_timestamp ;
?column?
----------------------
1999-11-15 06:57:38-05
(1 row)
finsbury=> set timezone='gmt';
SET VARIABLE
finsbury=> select current_timestamp ;
?column?
----------------------
1999-11-15 11:58:37+00
(1 row)
And also for the postgres user (by setting PGTZ=GMT in.bash_profile),
But how do I set the timezone when I start postgres so that dates are always
reported in GMT?
postgresql 6.4
RH6
TIA
timj
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] ResultSet.getDate
1999-11-15 11:29 Re: [INTERFACES] ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
@ 1999-11-15 14:29 ` Tim Joyce <tim@hoop.co.uk>
1 sibling, 0 replies; 22+ messages in thread
From: Tim Joyce @ 1999-11-15 14:29 UTC (permalink / raw)
To: Tim Joyce <tim@hoop.co.uk>; Peter Mount <peter@retep.org.uk>; paneris messageboard <paneris@messageboards.paneris.org>; pgsql-interfaces
Further to below,
I am now setting TZ=GMT PGDATESTYLE=ISO on postmaster startup:
finsbury=> select current_timestamp;
?column?
----------------------
1999-11-15 15:27:24+00
(1 row)
, but am still getting
- java.sql.SQLException: Bad Timestamp Format: at 0 in 1999-11-12 17:36:5EST
from the jdbc driver.
thanks for any help
timj
> > >
> > > >The date and time methods are being rewritten for 6.6 as they can't
> handle
> > > >some of the different time zones.
> > >
> > > Thanks, can I set postgres to pass dates to JDBC in a format that it
can
> > > understand?
> >
> > The SET DATESTYLE statement can be used to force the backend to return
> > dates in a particular format. The best one being ISO.
>
> This problem is still causing me headaches, I can change the timezone for
> the session:
>
> finsbury=> select current_timestamp ;
> ?column?
> ----------------------
> 1999-11-15 06:57:38-05
> (1 row)
>
> finsbury=> set timezone='gmt';
> SET VARIABLE
>
> finsbury=> select current_timestamp ;
> ?column?
> ----------------------
> 1999-11-15 11:58:37+00
> (1 row)
>
> And also for the postgres user (by setting PGTZ=GMT in.bash_profile),
> But how do I set the timezone when I start postgres so that dates are
always
> reported in GMT?
>
> postgresql 6.4
> RH6
>
> TIA
>
> timj
>
>
>
>
>
> ************
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] ResultSet.getDate
1999-11-15 11:29 Re: [INTERFACES] ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
@ 1999-11-15 15:00 ` Tom Lane <tgl@sss.pgh.pa.us>
1999-11-15 19:58 ` Re: [INTERFACES] ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
1 sibling, 1 reply; 22+ messages in thread
From: Tom Lane @ 1999-11-15 15:00 UTC (permalink / raw)
To: Tim Joyce <tim@hoop.co.uk>; +Cc: pgsql-interfaces
"Tim Joyce" <tim@hoop.co.uk> writes:
> But how do I set the timezone when I start postgres so that dates are always
> reported in GMT?
TZ when the postmaster is started sets the default zone, I believe.
There is no way to make it "always" report in GMT, if by that you
mean overriding clients' PGTZ settings.
regards, tom lane
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] ResultSet.getDate
1999-11-15 11:29 Re: [INTERFACES] ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
1999-11-15 15:00 ` Re: [INTERFACES] ResultSet.getDate Tom Lane <tgl@sss.pgh.pa.us>
@ 1999-11-15 19:58 ` Tim Joyce <tim@hoop.co.uk>
1999-11-19 15:24 ` Re: [INTERFACES] ResultSet.getDate Oscar Serrano <oserra@fondos.net>
0 siblings, 1 reply; 22+ messages in thread
From: Tim Joyce @ 1999-11-15 19:58 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces
> "Tim Joyce" <tim@hoop.co.uk> writes:
> > But how do I set the timezone when I start postgres so that dates are
always
> > reported in GMT?
>
> TZ when the postmaster is started sets the default zone, I believe.
> There is no way to make it "always" report in GMT, if by that you
> mean overriding clients' PGTZ settings.
thanks, but what is then the best way of avoiding the following exception:
java.sql.SQLException: Bad Timestamp Format: at 0 in 1999-11-12 17:36:5EST
cheers
timj
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: [INTERFACES] ResultSet.getDate
1999-11-15 11:29 Re: [INTERFACES] ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
1999-11-15 15:00 ` Re: [INTERFACES] ResultSet.getDate Tom Lane <tgl@sss.pgh.pa.us>
1999-11-15 19:58 ` Re: [INTERFACES] ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
@ 1999-11-19 15:24 ` Oscar Serrano <oserra@fondos.net>
0 siblings, 0 replies; 22+ messages in thread
From: Oscar Serrano @ 1999-11-19 15:24 UTC (permalink / raw)
To: pgsql-interfaces
Hi:
I'm from Spain. I've exported some tables from MS Access to Postgres. You
know, in Spain, a number like this: 1,234.56 me write it like this:
1.234,56
i.e., the thousand separator is the "." and the decimal separator is the ","
I'm going to use Perl (DBI) to get the data from the databases.
Is there anyway so DBI or postgress gives me the data in the spanish format?
I wouldn't like to use somethink like this:
$result=~s/\./,/g;
to convert all "." to "," and vice-versa.
Thanks
--
______________________________
Oscar Serrano
http://www.fondos.net
http://www.mercados.net
^ permalink raw reply [nested|flat] 22+ messages in thread
end of thread, other threads:[~1999-11-19 15:24 UTC | newest]
Thread overview: 22+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-01-31 06:31 ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-01 08:57 ` Urban Widmark <urban@svenskatest.se>
1999-02-01 13:46 ` Peter T Mount <peter@retep.org.uk>
1999-02-01 15:21 ` Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-01 16:42 ` Peter T Mount <peter@retep.org.uk>
1999-02-01 17:30 ` Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-01 19:16 ` Peter T Mount <peter@retep.org.uk>
1999-01-31 06:36 Re: ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-01 21:43 Re: ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-02 04:39 ` Aleksey Demakov <avd@gcom.ru>
1999-02-05 06:56 ` Peter T Mount <peter@retep.org.uk>
1999-02-01 22:16 Re: [INTERFACES] Re: ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-02 06:23 Re: [INTERFACES] Re: ResultSet.getDate Peter Garner <peter_garner@yahoo.com>
1999-02-05 06:55 ` Peter T Mount <peter@retep.org.uk>
1999-09-22 12:33 ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
1999-09-22 14:08 ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
1999-09-23 06:21 ` Peter Mount <peter@retep.org.uk>
1999-11-15 11:29 Re: [INTERFACES] ResultSet.getDate Tim Joyce <tim@hoop.co.uk>
1999-11-15 14:29 ` Tim Joyce <tim@hoop.co.uk>
1999-11-15 15:00 ` Tom Lane <tgl@sss.pgh.pa.us>
1999-11-15 19:58 ` Tim Joyce <tim@hoop.co.uk>
1999-11-19 15:24 ` Oscar Serrano <oserra@fondos.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox