db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saravana Krishnan Kannan" <skka...@mail.uky.edu>
Subject Re: Re: [Fwd: RE: Date vs timestamp with Oracle]
Date Tue, 17 Aug 2004 12:10:48 GMT
There is definitely more than just a name change between class12.jar and ojdbc14.jar. I think
the former follows JDBC 1.2 spec and the latter follows JDBC 1.4 spec. I'm not sure what exactly
the changes are but I remember reading something in Oracle.com that said there was a difference.

-Sarav


-----Original Message-----
From: Thomas Fischer <Fischer@seitenbau.net>
To: "Apache Torque Users List" <torque-user@db.apache.org>
Date: Tue, 17 Aug 2004 10:36:33 +0200
Subject: Re: [Fwd: RE: Date vs timestamp with Oracle]





Hi,

I was just reading the other threads in the mailing list about the
date/timespamp issue, and it seems that, contrary to my testing, the time
and timestamp types work for other people. Of course there is always the
possibility that I have made some other mistake, but as the code runs when
I revert the changes in db.props, this seems not very probable to me.
Perhaps the reason why timestamp does not work for me is because I'm using
the classes12.jar library which is provided with the 9.0 version of oracle.
I have seen that in newer versions of the database, the oracle jdbc have
changed their names to e.g. ojdbc14.jar, and perhaps there are other
changes than just the name.
I guess that for resolving the date/timestamp issue in the 3.2 release, it
would be nice to collect more information about the driver (and village)
versions where the patch is working or not, so if somebody has tried it, it
would be nice if they would post it to the list.

   Cheers,

     Thomas

Scott Eade <seade@backstagetech.com.au> schrieb am 17.08.2004 04:41:32:

> Thomas Fischer wrote:
>
> >Just tried the patch and I had problems writing a timestamp to a Oracle
9i
> >Database.
> >I did the following:
> >- apply the patch to db.props from the torque-3.1-release (by the way:
the
> >patch is reversed, i.e. I had to apply the -R option for patching)
> >
> Yes, that is right.
>
> >- create an object with a timestamp value
> >(snippet from project-schema.xml)
> >  <table name="author" description="Author Table">
> >    <column
> >      name="author_id"
> >      required="true"
> >      primaryKey="true"
> >      type="INTEGER"
> >      description="Author Id"/>
> >    <column
> >      name="last_name"
> >      required="false"
> >      type="VARCHAR"
> >      size="128"
> >      description="Last Name"/>
> >    <column
> >      name="last_write_date"
> >      required="false"
> >      type="TIMESTAMP"
> >      description="Last write timestamp"/>
> >  </table>
> >
> >- run the following code
> >
> >  public void testLastWriteDate() {
> >    try {
> >      Author author = new Author();
> >      author.setLastWriteDate(someDateObject_see_below);
> >      author.save();
> >    }
> >    catch (Exception e) {
> >      fail(e.getClass().getName() + " : " + e.getMessage());
> >    }
> >  }
> >
> >- The following errors occur:
> >If I use
> >
> >author.setLastWriteDate(new Timestamp(System.currentTimeMillis()));
> >or
> >author.setLastWriteDate(new java.sql.Date(System.currentTimeMillis()));
> >
> >I get the following exception:
> >ORA-01843: Kein g├╝ltiger Monat (in english: "no valid month")
> >
> >If I use
> >
> >author.setLastWriteDate(new java.util.Date());
> >
> >I get:
> >ORA-01858: ein nicht-numerisches Zeichen wurde gefunden, wo numerisches
> >erwartet wurde (in english: a non-numeric character was found where a
> >numeric character was expected)
> >
> >If I use the original db.props from the 3.1 release, the above test case
> >does not give an error, although the precision of the date is limited to
> >full seconds.
> >
> >So it seems that, in addition to patching db.props, additional changes
are
> >necessary to get a timestamp with better precision than seconds.
However,
> >as db.props no longer appears in the CVS HEAD branch, I am not sure
whether
> >it is worth while to pursue this issue for the 3.1.1 release.
> >
> In CVS HEAD the change would be:
>
> Index: PlatformOracleImpl.java
> ===================================================================
> RCS file:
> /home/cvs/db-
>
torque/src/generator/src/java/org/apache/torque/engine/platform/PlatformOracleImpl.

> java,v
> retrieving revision 1.6
> diff -u -r1.6 PlatformOracleImpl.java
> --- PlatformOracleImpl.java    22 Feb 2004 06:27:19 -0000    1.6
> +++ PlatformOracleImpl.java    17 Aug 2004 02:38:12 -0000
> @@ -53,8 +53,8 @@
>          setSchemaDomainMapping(new Domain(SchemaType.NUMERIC,
"NUMBER"));
>          setSchemaDomainMapping(new Domain(SchemaType.VARCHAR,
"VARCHAR2"));
>          setSchemaDomainMapping(new Domain(SchemaType.LONGVARCHAR,
> "VARCHAR2", "2000"));
> -        setSchemaDomainMapping(new Domain(SchemaType.TIME, "DATE"));
> -        setSchemaDomainMapping(new Domain(SchemaType.TIMESTAMP,
"DATE"));
> +        setSchemaDomainMapping(new Domain(SchemaType.TIME, "TIME"));
> +        setSchemaDomainMapping(new Domain(SchemaType.TIMESTAMP,
> "TIMESTAMP"));
>          setSchemaDomainMapping(new Domain(SchemaType.BINARY, "LONG
RAW"));
>          setSchemaDomainMapping(new Domain(SchemaType.VARBINARY,
"BLOB"));
>          setSchemaDomainMapping(new Domain(SchemaType.LONGVARBINARY,
> "LONG RAW"));
>
> >
> >By the way, the errors occur with Sarav's village jar (version 20040806)
as
> >well as with the original village.jar.
> >
> >Thomas
> >
> After seeing your testing I don't think I will apply this for 3.1.1.
>
> As for 3.2-dev (HEAD) it will be up to someone else to determine the
> full set of changes required to make this work for Oracle - volunteers
> welcome.
>
> Thanks,
>
> Scott
>
> --
> Scott Eade
> Backstage Technologies Pty. Ltd.
> http://www.backstagetech.com.au
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message