X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EBDC8D84EC for ; Thu, 13 Oct 2005 05:33:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18590-07 for ; Thu, 13 Oct 2005 08:33:42 +0000 (GMT) Received: from xmail06.myhosting.com (xmail06.myhosting.com [168.144.250.220]) by svr1.postgresql.org (Postfix) with ESMTP id A11ACD849E for ; Thu, 13 Oct 2005 05:33:43 -0300 (ADT) Received: (qmail 13283 invoked from network); 13 Oct 2005 08:33:44 -0000 Received: from unknown (HELO [192.168.1.2]) (Authenticated-user:_aydin.toprak@intengo.com@[85.101.60.52]) (envelope-sender ) by xmail06.myhosting.com (qmail-ldap-1.03) with SMTP for ; 13 Oct 2005 08:33:43 -0000 Message-ID: <434E1BE2.2060108@intengo.com> Date: Thu, 13 Oct 2005 11:33:38 +0300 From: =?UTF-8?B?QXlkxLFuIFRvcHJhaw==?= User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: How to insert "date" as timestamp References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------090502060408050605060401" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.051 required=5 tests=[AWL=-0.051, HTML_30_40=0.056, HTML_MESSAGE=0.001, HTML_TITLE_EMPTY=0.045] X-Spam-Level: X-Archive-Number: 200510/52 X-Sequence-Number: 13983 This is a multi-part message in MIME format. --------------090502060408050605060401 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, My Object is java.util.Date ... first of all; I make an instance of the Date object Date date = new Date(); then I am wirting the set methods of the preparedstatement as query.setDate(1,date); however eclipse gives an error message, which is "The method setDate(int, Date) in the type PreparedStatement is not applicable for the arguments (int, Date)"... (but eclipse say that it can!) so sorry for stack trace but I cant even compile it yet... I need time of the day, and the date... timezone and other staff is not important... 13/10/2005 11:30 .. or something like this is enough for me ... Kevin Grittner wrote: >Hi, > >Is your object a java.util.Date, a java.sql.Date, or a >java.sql.Timestamp? Do you want the column in the database to >store only a date, or combined date and time? If you want the >column to store a combined date and time, you should define it >as TIMESTAMP WITH TIME ZONE unless you have some very >unusual need to have a timestamp that represents a different >moment in each time zone. > >Some sample code and your exception (with stack trace) would >help, too. > >-Kevin > > > >>>>Ayd*n Toprak 10/13/05 1:20 AM >>> >>>> >>>> >hii, > > >I am newbie for jdbc-postgres and looking for some help about timestamp >type of posgresql..... > > >my porgram makes a data object, and then insert this object to the db. >however, I couldnt been able to insert date object directly to the db as >timestamp ... > >do I making something wrong ? .. or is there another type to keep full >date of java, in the Postgresql Db. > >Thank You. > >---------------------------(end of broadcast)--------------------------- >TIP 6: explain analyze is your friend > > > > > --------------090502060408050605060401 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi,

My Object is java.util.Date ... first of all;
I make an instance of the Date object

Date date = new Date();

then

I am wirting the set methods of the preparedstatement as

query.setDate(1,date);

however eclipse gives an error message, which is "The method setDate(int, Date) in the type PreparedStatement is not applicable for the arguments (int, Date)"...
<b>(but eclipse say that it can!)</b>

so sorry for stack trace but I cant even compile it yet...

I need time of the day, and the date... timezone and other staff  is not important...

13/10/2005 11:30 .. or something like this is enough for me ...



Kevin Grittner wrote:
Hi,

Is your object a java.util.Date, a java.sql.Date, or a
java.sql.Timestamp?  Do you want the column in the database to
store only a date, or combined date and time?  If you want the
column to store a combined date and time, you should define it
as TIMESTAMP WITH TIME ZONE unless you have some very
unusual need to have a timestamp that represents a different
moment in each time zone.

Some sample code and your exception (with stack trace) would
help, too.

-Kevin

  
Ayd*n Toprak <aydin.toprak@intengo.com> 10/13/05 1:20 AM >>>
        
hii,


I am newbie for jdbc-postgres and looking for some help about timestamp 
type of posgresql.....


my porgram makes a data object, and then insert this object to the db.
however, I couldnt been able to insert date object directly to the db as 
timestamp ...

do I making something wrong ? .. or is there another type to keep full 
date of java, in the Postgresql Db.

Thank You.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend



  

--------------090502060408050605060401--