pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feeddate value not geting inserted properly
4+ messages / 3 participants
[nested] [flat]
* date value not geting inserted properly
@ 2006-06-07 11:54 surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>
2006-06-07 12:30 ` Re: date value not geting inserted properly Oliver Jowett <oliver@opencloud.com>
2006-06-08 02:35 ` Re: date value not geting inserted properly Chris <dmagick@gmail.com>
0 siblings, 2 replies; 4+ messages in thread
From: surabhi.ahuja @ 2006-06-07 11:54 UTC (permalink / raw)
To: pgsql-jdbc; pgsql-general@postgresql.org
i have a cloumn in my table which is date type
i parse a file to get the date from there,
and then i form a call to the stored procedure, with the above data as the parameter.
but however it seems that when i form this call, something is messing up, and the value for the birth date, getting into that field is "1969-12-31" ,
and this happens always, it inserts this value only, whtever be the input data value.
i am pasting the code that i am trying to do
stmt.setObject(i + 1, (tagV.value),
((TypeAttrib) (primaryKeyMap_.get(tMap.get(temp)))).dataType);
can u please tell as to what should the dataType be for date, isnt it 91- integer?
thanks,
regards
Surabhi
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: date value not geting inserted properly
2006-06-07 11:54 date value not geting inserted properly surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>
@ 2006-06-07 12:30 ` Oliver Jowett <oliver@opencloud.com>
2006-06-07 13:52 ` Re: date value not geting inserted properly surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>
1 sibling, 1 reply; 4+ messages in thread
From: Oliver Jowett @ 2006-06-07 12:30 UTC (permalink / raw)
To: surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>; +Cc: pgsql-jdbc
surabhi.ahuja wrote:
> stmt.setObject(i + 1, (tagV.value),
> ((TypeAttrib) (primaryKeyMap_.get(tMap.get(temp)))).dataType);
>
> can u please tell as to what should the dataType be for date, isnt it
> 91- integer?
java.sql.Types.DATE is 91, which should be correct if you're inserting a
bare date (with no time part).
What is the type and value of the "tagV.value" object?
What driver version and server version are you using?
What is the query you are executing?
Can you provide a selfcontained testcase showing the problem? You
haven't really given us enough info to go on here.
-O
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: date value not geting inserted properly
2006-06-07 11:54 date value not geting inserted properly surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>
2006-06-07 12:30 ` Re: date value not geting inserted properly Oliver Jowett <oliver@opencloud.com>
@ 2006-06-07 13:52 ` surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>
0 siblings, 0 replies; 4+ messages in thread
From: surabhi.ahuja @ 2006-06-07 13:52 UTC (permalink / raw)
To: Oliver Jowett <oliver@opencloud.com>; +Cc: pgsql-jdbc
yes that is an Object type.
i figued out the problem,
the value was something like "yyyymmdd"
so i needed to convert it to a date type and then do a setObject.
thanks,
regards
Surabhi
________________________________
From: Oliver Jowett [mailto:oliver@opencloud.com]
Sent: Wed 6/7/2006 6:00 PM
To: surabhi.ahuja
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] date value not geting inserted properly
***********************
Your mail has been scanned by InterScan VirusWall.
***********-***********
surabhi.ahuja wrote:
> stmt.setObject(i + 1, (tagV.value),
> ((TypeAttrib) (primaryKeyMap_.get(tMap.get(temp)))).dataType);
>
> can u please tell as to what should the dataType be for date, isnt it
> 91- integer?
java.sql.Types.DATE is 91, which should be correct if you're inserting a
bare date (with no time part).
What is the type and value of the "tagV.value" object?
What driver version and server version are you using?
What is the query you are executing?
Can you provide a selfcontained testcase showing the problem? You
haven't really given us enough info to go on here.
-O
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: date value not geting inserted properly
2006-06-07 11:54 date value not geting inserted properly surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>
@ 2006-06-08 02:35 ` Chris <dmagick@gmail.com>
1 sibling, 0 replies; 4+ messages in thread
From: Chris @ 2006-06-08 02:35 UTC (permalink / raw)
To: surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>; +Cc: pgsql-general@postgresql.org
surabhi.ahuja wrote:
> i have a cloumn in my table which is date type
>
> i parse a file to get the date from there,
>
> and then i form a call to the stored procedure, with the above data as
> the parameter.
>
> but however it seems that when i form this call, something is messing
> up, and the value for the birth date, getting into that field is
> "1969-12-31" ,
> and this happens always, it inserts this value only, whtever be the
> input data value.
>
> i am pasting the code that i am trying to do
>
> stmt.setObject(i + 1, (tagV.value),
> ((TypeAttrib) (primaryKeyMap_.get(tMap.get(temp)))).dataType);
>
> can u please tell as to what should the dataType be for date, isnt it
> 91- integer?
No - a date is a date, it's completely different from an integer.
Since this is java, the jdbc list should be able to help you a bit more
than this one.
--
Postgresql & php tutorials
http://www.designmagick.com/
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-06-08 02:35 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-06-07 11:54 date value not geting inserted properly surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>
2006-06-07 12:30 ` Oliver Jowett <oliver@opencloud.com>
2006-06-07 13:52 ` surabhi.ahuja <surabhi.ahuja@iiitb.ac.in>
2006-06-08 02:35 ` Chris <dmagick@gmail.com>
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