The jdbc and current_timestamp - Mailing list pgsql-general

From stevegy@126.com
Subject The jdbc and current_timestamp
Date
Msg-id 45ADBD64.000035.10114@bj126app2.126.com
Whole thread Raw
Responses Re: The jdbc and current_timestamp
List pgsql-general
Hi, all
 
I get a problem with the jdbc and timestamp data column.
My postgresql running on the Solaris 10 and version is 8.1.6.
The table looks like this,
 
create DOMAIN CURRENTTIME AS TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
 
create table RY_ArticleCollection (
ArtID                INT4                 not null,
UID                  INT4                 not null,
CollectTime          CURRENTTIME          not null,
Note                 VARCHAR(100)         null,
constraint PK_RY_ARTICLECOLLECTION primary key (ArtID, UID)
);
 
I can use the psql tool to issue a SQL command "insert" like this:
insert into ry_articlecollection(..., CollectTime) values(..., CURRENT_TIMESTAMP);
The CollectTime always looks correct in the local machine time. But, I test my web application on my PC running the java web server and use the connection pool supplied by the appserver. When I execute the same SQL command to insert data, I get some weird time values and randomly slower than the postgresql server machine.
 
For example, the machine time is 11:46:xx, and I execute the SQL insert through the jdbc, the record time will be changed to 10:52:xx. I mean the time value is always slower than the machine time but not for a fixed time period.
 
My java appserver is Sun Java appserver platform 8.2. The jdbc driver is postgresql-8.1-408.jdbc3.jar.
 
I guess the problem may be the db connection or the connection pool. But not sure, and I tested other web java application on the same machine and same software but not DOMAIN data type on column, that has no such error. So, I modify the column to native data type: 'timestamp', but the error is still there.
 
Anyone can help me? Thanks.
 
Steve Yao
 



独家!网易3G免费邮,还赠送280兆网盘 www.126.com

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: [1/2 OFF] Varlena.com inaccessible from .br (Blocked?)
Next
From: "Albe Laurenz"
Date:
Subject: Re: Need help on SP