Clarification:
> Also, isn't p6spy just logging? I don't think it's correct to say
> "p6spy always built...".
Yes, I meant to say that p6spy is "reporting" the query.
Also, a criteria that uses java.sql.Date results in a query of:
A0.audit_date > '2003-01-01'
while java.sql.Timestamp and java.util.Date results in a query of:
A0.audit_date > '2003-01-01 00:00:00.0'
Normally, a "manual" oracle date query would look something like this:
A0.audit_date > TO_DATE('01-JAN-2001 00:00:00','DD-MON-YYYY HH24:MI:SS')
But this is not a portable query.
Also, I'm using Oracle 8.1.6 on AIX 4.3.
The original "default" nsl_date_format was: DD-MON-RR
----- Original Message -----
From: "Joe Germuska" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 18, 2004 19:55
Subject: Re: Oracle date tip
> Thanks for the info; however, it doesn't seem right that you should
> have to set the NLS_DATE_FORMAT to cooperate with OJB!
>
> Is this a property of the JDBC driver you are using? I don't think
> I've encountered this before; I'm not an OJB wizard, but I'm pretty
> sure I've got some date-based queries.
>
> It seems like, in all the abstraction of OJB, there ought to be a
> place where you could configure this to behave correctly without
> being forced to change your database settings.
>
> Also, isn't p6spy just logging? I don't think it's correct to say
> "p6spy always built...".
>
> Just some thoughts from another OJB/Oracle user.
>
> Joe
>
>
> At 7:13 PM -0700 2/18/04, Brad Matlack wrote:
> >Hi,
> >
> >After struggling and searching for a solution to Oracle date comparisons,
> >I'ld like to share what I came up with.
> >
> >Using the standard TIMESTAMP descriptor where "date" is a java.util.Date:
> ><field-descriptor
> >name="date"
> >column="audit_date"
> >jdbc-type="TIMESTAMP"
>
>conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimes
t
> >ampFieldConversion"
> >/>
> >
> >and the criteria:
> >criteria.addGreaterThan("date", fromJavaUtilDate);
> >or:
> >criteria.addGreaterThan("date", fromJavaSqlDate);
> >
> >p6spy always built this where clause which failed:
> >
> >A0.audit_date > '2003-01-01 00:00:00.0'
> >
> >By setting the NSL_DATE_FORMAT in the init.ora to this:
> >
> >nls_date_format="YYYY-MM-DD HH24:MI:SS"
> >
> >we have success!
> >
> >Hope that helps future Oracle developers.
> >Cheers,
> >Brad
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> --
> Joe Germuska
> [EMAIL PROTECTED]
> http://blog.germuska.com
> "Imagine if every Thursday your shoes exploded if you tied them
> the usual way. This happens to us all the time with computers, and
> nobody thinks of complaining."
> -- Jef Raskin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]