You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by ernst leonhard <el...@secure-net.de> on 2001/04/11 12:22:14 UTC
torque: Problems with DATE (oracle)
Hi all,
we have problems using DATE with Oracle (in the schema-file we use
"TIMESTAMP"). Saving a java.util.Date to the DB works well. When we
retrieve the record from the DB and try to retrieve the Date field then
the hours, minutes and seconds are set to 0.
What is wrong ?
TDK Version: TDK 1.1a11
Database : Oracle
Database table : mdc_user
Database field : created (in schema: TIMESTAMP --> in oracle DB: DATE)
Example Code
// McdUser: extends ...om.BaseObject
McdUser clientAdmin = ...
clientAdmin.setCreated( new java.util.Date() );
... save to DB (the DB contains the correct value with hours,
minutes,... !!!)
try {
McdUser testUser = McdUserPeer.retrieveByPK( clientAdmin.getId() );
log.debug("Date retrieved from DB: " +
testUser.getCreated().getTime());
log.debug("Date saved to DB: " + clientAdmin.getCreated().getTime());
} catch ( Exception exp ) { /* */}
Result:
11.04.01 12:16 AdminClient DEBUG Date retrieved from DB:
986940000000
11.04.01 12:16 AdminClient DEBUG Date saved to DB: 986984210483
Thanks for any help !!
--
Ernst Leonhard
mailto:el@secure-net.de
_______________________________________________________________
SecureNet GmbH
Intranet und Internet Solutions Tel: +49 89/32133-654
Frankfurter Ring 193a Fax: +49 89/32133-699
80807 München, Germany http://www.secure-net.de
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: torque: Problems with DATE (oracle)
Posted by ernst leonhard <el...@secure-net.de>.
John McNally wrote:
>
> Are you using the latest village jar supplied with turbine? If, not try
> it.
yes, but this didn' t solve the problem.
I think, it's a torque bug in the peer generation. I've changed the
follwing line in TypeMap.java (package org.apache.turbine.torque.model):
// old: public static final String TIMESTAMP_VILLAGE_METHOD =
"asDate()";
public static final String TIMESTAMP_VILLAGE_METHOD =
"asTimestamp()";
and everything works...
>
> john mcnally
>
> ernst leonhard wrote:
> >
> > Hi all,
> >
> > we have problems using DATE with Oracle (in the schema-file we use
> > "TIMESTAMP"). Saving a java.util.Date to the DB works well. When we
> > retrieve the record from the DB and try to retrieve the Date field then
> > the hours, minutes and seconds are set to 0.
> >
> > What is wrong ?
> >
> > TDK Version: TDK 1.1a11
> > Database : Oracle
> > Database table : mdc_user
> > Database field : created (in schema: TIMESTAMP --> in oracle DB: DATE)
> >
> > Example Code
> > // McdUser: extends ...om.BaseObject
> > McdUser clientAdmin = ...
> > clientAdmin.setCreated( new java.util.Date() );
> > ... save to DB (the DB contains the correct value with hours,
> > minutes,... !!!)
> >
> > try {
> > McdUser testUser = McdUserPeer.retrieveByPK( clientAdmin.getId() );
> > log.debug("Date retrieved from DB: " +
> > testUser.getCreated().getTime());
> > log.debug("Date saved to DB: " + clientAdmin.getCreated().getTime());
> > } catch ( Exception exp ) { /* */}
> >
> > Result:
> > 11.04.01 12:16 AdminClient DEBUG Date retrieved from DB:
> > 986940000000
> > 11.04.01 12:16 AdminClient DEBUG Date saved to DB: 986984210483
> >
> > Thanks for any help !!
> > --
> > Ernst Leonhard
> >
> > mailto:el@secure-net.de
> > _______________________________________________________________
> > SecureNet GmbH
> > Intranet und Internet Solutions Tel: +49 89/32133-654
> > Frankfurter Ring 193a Fax: +49 89/32133-699
> > 80807 München, Germany http://www.secure-net.de
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
--
Ernst Leonhard
mailto:el@secure-net.de
_______________________________________________________________
SecureNet GmbH
Intranet und Internet Solutions Tel: +49 89/32133-654
Frankfurter Ring 193a Fax: +49 89/32133-699
80807 München, Germany http://www.secure-net.de
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: torque: Problems with DATE (oracle)
Posted by John McNally <jm...@collab.net>.
Are you using the latest village jar supplied with turbine? If, not try
it.
john mcnally
ernst leonhard wrote:
>
> Hi all,
>
> we have problems using DATE with Oracle (in the schema-file we use
> "TIMESTAMP"). Saving a java.util.Date to the DB works well. When we
> retrieve the record from the DB and try to retrieve the Date field then
> the hours, minutes and seconds are set to 0.
>
> What is wrong ?
>
> TDK Version: TDK 1.1a11
> Database : Oracle
> Database table : mdc_user
> Database field : created (in schema: TIMESTAMP --> in oracle DB: DATE)
>
> Example Code
> // McdUser: extends ...om.BaseObject
> McdUser clientAdmin = ...
> clientAdmin.setCreated( new java.util.Date() );
> ... save to DB (the DB contains the correct value with hours,
> minutes,... !!!)
>
> try {
> McdUser testUser = McdUserPeer.retrieveByPK( clientAdmin.getId() );
> log.debug("Date retrieved from DB: " +
> testUser.getCreated().getTime());
> log.debug("Date saved to DB: " + clientAdmin.getCreated().getTime());
> } catch ( Exception exp ) { /* */}
>
> Result:
> 11.04.01 12:16 AdminClient DEBUG Date retrieved from DB:
> 986940000000
> 11.04.01 12:16 AdminClient DEBUG Date saved to DB: 986984210483
>
> Thanks for any help !!
> --
> Ernst Leonhard
>
> mailto:el@secure-net.de
> _______________________________________________________________
> SecureNet GmbH
> Intranet und Internet Solutions Tel: +49 89/32133-654
> Frankfurter Ring 193a Fax: +49 89/32133-699
> 80807 München, Germany http://www.secure-net.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Oracle-HOWTO: No suitable driver
Posted by Long Lin Yu <ly...@citiz.net>.
Hi everybody,
I followed the instructions of
http://jakarta.apache.org/turbine/oracle-howto.html to setup my tdk1.1a13
environment. The only difference is that I am using Oracle-JDBC driver
"classes12.zip" instead of "classes12_01.zip". All the work of building my
project goes smooth. But when I run my project, any BasePeer will cause a
error as following:
java.sql.SQLException: No suitable driver
at com.msft.actions.Vlogin.doPerform(Vlogin.java:56)
at
org.apache.turbine.modules.actions.VelocityAction.doPerform(VelocityAction.j
ava:88)
at
org.apache.turbine.util.velocity.VelocityActionEvent.perform(VelocityActionE
vent.java:116)
at
org.apache.turbine.modules.actions.VelocityAction.perform(VelocityAction.jav
a:114)
at org.apache.turbine.modules.ActionLoader.exec(ActionLoader.java:122)
at
org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:148)
at org.apache.turbine.modules.Page.build(Page.java:90)
at org.apache.turbine.modules.PageLoader.exec(PageLoader.java:123)
at org.apache.turbine.Turbine.doGet(Turbine.java:414)
at org.apache.turbine.Turbine.doPost(Turbine.java:505)
the source code is extremely simple as following :(
---------------------------------
Criteria criteria = new Criteria();
criteria.add( UsersPeer.LOGINNAME, loginName );
Vector users = null;
users = UsersPeer.doSelect(criteria); <------- here throws the exception
---------------------------------
Runtime environments:
Oracle 8i(8.1.5)
JDK 1.3.1-beta
TDK 1.1a13
Oracle 8i JDBC type 4 Thin driver for JDK 1.2.x -- classes12.zip from
oracle.com
---------------------------------
Anybody has ideas about this ?
Thanks in advance.
-lylong
mailto: lylong@citiz.net
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: torque: Problems with DATE (oracle)
Posted by Hebeisen Andy <an...@softline-intra.ch>.
I had the same problem on my system.
After adding this line the file "pfile/initSID.ora" everything worked fine:
nls_date_format="YYYY-MM-DD"
Hope that works for you too.
Andy Hebeisen
softline intra
CH-8472 Seuzach
andy.hebeisen@softline-intra.ch
----- Original Message -----
From: "ernst leonhard" <el...@secure-net.de>
To: "Turbine" <tu...@jakarta.apache.org>
Sent: Wednesday, April 11, 2001 12:22 PM
Subject: torque: Problems with DATE (oracle)
> Hi all,
>
> we have problems using DATE with Oracle (in the schema-file we use
> "TIMESTAMP"). Saving a java.util.Date to the DB works well. When we
> retrieve the record from the DB and try to retrieve the Date field then
> the hours, minutes and seconds are set to 0.
>
> What is wrong ?
>
> TDK Version: TDK 1.1a11
> Database : Oracle
> Database table : mdc_user
> Database field : created (in schema: TIMESTAMP --> in oracle DB: DATE)
>
> Example Code
> // McdUser: extends ...om.BaseObject
> McdUser clientAdmin = ...
> clientAdmin.setCreated( new java.util.Date() );
> ... save to DB (the DB contains the correct value with hours,
> minutes,... !!!)
>
> try {
> McdUser testUser = McdUserPeer.retrieveByPK( clientAdmin.getId() );
> log.debug("Date retrieved from DB: " +
> testUser.getCreated().getTime());
> log.debug("Date saved to DB: " + clientAdmin.getCreated().getTime());
> } catch ( Exception exp ) { /* */}
>
> Result:
> 11.04.01 12:16 AdminClient DEBUG Date retrieved from DB:
> 986940000000
> 11.04.01 12:16 AdminClient DEBUG Date saved to DB: 986984210483
>
> Thanks for any help !!
> --
> Ernst Leonhard
>
> mailto:el@secure-net.de
> _______________________________________________________________
> SecureNet GmbH
> Intranet und Internet Solutions Tel: +49 89/32133-654
> Frankfurter Ring 193a Fax: +49 89/32133-699
> 80807 München, Germany http://www.secure-net.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: torque: Problems with DATE (oracle)
Posted by Age Mooy <am...@home.nl>.
Your Oracle internal date format is probably set to something like
"dd-MMM-yyyy", which means it just rounds all DATEs down to midnight.
I don't know of any generic way to change this behaviour... I think there are
two things you can do:
- change your Oracle internal date format (I don't have my Oracle docs here so
look it up).
or
- use a hardcoded to_date(datestring, 'dd-MMM-yyyy mm:hh') in your SQL (using
Criteria.CUSTOM)
Not very ideal.... hope it helps,
Age
> -----Original Message-----
> From: ernst leonhard [mailto:el@secure-net.de]
> Sent: Wednesday, April 11, 2001 12:22
> To: Turbine
> Subject: torque: Problems with DATE (oracle)
>
>
> Hi all,
>
> we have problems using DATE with Oracle (in the schema-file we use
> "TIMESTAMP"). Saving a java.util.Date to the DB works well. When we
> retrieve the record from the DB and try to retrieve the Date field then
> the hours, minutes and seconds are set to 0.
>
> What is wrong ?
>
> TDK Version: TDK 1.1a11
> Database : Oracle
> Database table : mdc_user
> Database field : created (in schema: TIMESTAMP --> in oracle DB: DATE)
>
> Example Code
> // McdUser: extends ...om.BaseObject
> McdUser clientAdmin = ...
> clientAdmin.setCreated( new java.util.Date() );
> ... save to DB (the DB contains the correct value with hours,
> minutes,... !!!)
>
> try {
> McdUser testUser = McdUserPeer.retrieveByPK( clientAdmin.getId() );
> log.debug("Date retrieved from DB: " +
> testUser.getCreated().getTime());
> log.debug("Date saved to DB: " + clientAdmin.getCreated().getTime());
> } catch ( Exception exp ) { /* */}
>
> Result:
> 11.04.01 12:16 AdminClient DEBUG Date retrieved from DB:
> 986940000000
> 11.04.01 12:16 AdminClient DEBUG Date saved to DB: 986984210483
>
> Thanks for any help !!
> --
> Ernst Leonhard
>
> mailto:el@secure-net.de
> _______________________________________________________________
> SecureNet GmbH
> Intranet und Internet Solutions Tel: +49 89/32133-654
> Frankfurter Ring 193a Fax: +49 89/32133-699
> 80807 München, Germany http://www.secure-net.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org