Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 96796 invoked from network); 4 Aug 2005 17:31:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Aug 2005 17:31:01 -0000 Received: (qmail 51403 invoked by uid 500); 4 Aug 2005 17:30:59 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 51389 invoked by uid 500); 4 Aug 2005 17:30:59 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 51375 invoked by uid 99); 4 Aug 2005 17:30:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Aug 2005 10:30:59 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [131.228.20.94] (HELO mgw-ext02.nokia.com) (131.228.20.94) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Aug 2005 10:30:48 -0700 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-ext02.nokia.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j74HUroV029792 for ; Thu, 4 Aug 2005 20:30:55 +0300 Received: from daebh102.NOE.Nokia.com ([10.241.35.112]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 4 Aug 2005 20:30:52 +0300 Received: from daebe102.NOE.Nokia.com ([10.241.35.115]) by daebh102.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 4 Aug 2005 12:30:49 -0500 Received: from [127.0.0.1] ([172.18.87.78]) by daebe102.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 4 Aug 2005 12:30:49 -0500 Message-ID: <42F250C7.5010806@nokia.com> Date: Thu, 04 Aug 2005 10:30:47 -0700 From: Robert Dietrick User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: torque-user@db.apache.org Subject: Torque + Oracle 9i + DATE columns losing time SOLUTION Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Aug 2005 17:30:49.0666 (UTC) FILETIME=[417A4A20:01C5991A] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Just thought I would document the solution I found to a problem which seems to be fairly prevalent. It took a full day of searching mailing lists, hacking the Village classes, and scouring the Oracle support message boards to finally find this simple solution: oracle.jdbc.V8Compatible=true We recently upgraded from Oracle 8.1.7 to Oracle 9i. With the new version of the Oracle 9i JDBC drivers Oracle changed the way they report the column type meta data for date columns. This causes the village library to think DATE columns are SQL DATE types rather than DATETIME and truncate the time portion of dates before inserting into these columns. The often quoted solution is to modify your XML database schema to define your DATE columns instead as TIMESTAMP and regenerate your DDL. However, this doesn't help you if you've already got a deployed schema with data in it. It would be a failry tedious process for a DBA to modify the column types of populated tables. It turns out there is a system property you can set which forces the Oracle JDBC drivers into version 8 compatibility mode with respect to reporting of date types in meta-data. Just pass this to your Java VM with "-Doracle.jdbc.V8Compatible=true", and, walla!, Torque now persists the time portion of your date columns once again. The only remaining question now is: why on earth does Torque query the database meta data before inserting when the OR mapping provides all the information the system needs about the database? -- Robert Dietrick --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org