pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aydın Toprak <aydin.toprak@intengo.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: How to insert "date" as timestamp
Date: Thu, 13 Oct 2005 11:33:38 +0300
Message-ID: <434E1BE2.2060108@intengo.com> (raw)
In-Reply-To: <s34dbd65.061@gwmta.wicourts.gov>
References: <s34dbd65.061@gwmta.wicourts.gov>

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
>
>
>
>  
>

view thread (10+ messages)  latest in thread

Message-ID: <434E1BE2.2060108@intengo.com>
Permalink:  ../434E1BE2.2060108@intengo.com/
Also on:    postgresql.org/message-id/434E1BE2.2060108@intengo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: aydin.toprak@intengo.com
  Subject: Re: How to insert "date" as timestamp
  In-Reply-To: <434E1BE2.2060108@intengo.com>
  References: <s34dbd65.061@gwmta.wicourts.gov> <434E1BE2.2060108@intengo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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