You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Christine Keim <im...@ycn.com> on 2002/07/16 23:32:05 UTC

Timestamp problem with postgresql

Hija,

i'm using postgresql with tdk 2.1, i have a bytea fixed jar
and all worked fine till i wanted to get the values of a Timestamp
from the DB.
Date works fine, even STORING Dates as Timestamps works. Only when
i retrieve Objects with the Peers, a Method returning a Date where
on the DB a Timestamp is used, returns null (even the
TurbineUser.getCreated() - Method).
Well, i tried to do a simple query where i got back a single timestamp with
a peer.
Code is the following:

        Vector vec = KnowledgeObjectPeer.executeQuery("SELECT created FROM
knowledge_object WHERE id = 100");
        if (!vec.isEmpty())
        {
            Record rec = (Record) vec.firstElement();
            Value val = rec.getValue("created");
            try
            {
                System.out.println("String-->" + val.toString());
                System.out.println("date-->" + val.asDate());
            }
            catch (DataSetException e)
            {
                e.printStackTrace();
            }

the value is fine when i use the method toString() on it, but the method
asDate()  throws a DataSetException :
Bad date value - Java Timestamp Objects cannot be earlier than 1/1/70

Now i thought, maybe this is a year2k bug, and i set the date to
1999something.
but also then this exception occurs. Anyone got a clue? I need the timestamp
on the DB, and i would rather prefer keeping the value in one field than
splitting it up in 2 (one date and one time)

I got the feeling this is all a driver-problem, if someone knows and
perhaps has a driver where the problem's fixed,
i would really appreciate a link to download it ^^

tia, Christine


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>