Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 43958 invoked from network); 2 Feb 2009 23:46:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Feb 2009 23:46:11 -0000 Received: (qmail 57968 invoked by uid 500); 2 Feb 2009 23:46:10 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 57938 invoked by uid 500); 2 Feb 2009 23:46:10 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 57929 invoked by uid 99); 2 Feb 2009 23:46:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Feb 2009 15:46:10 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [64.13.152.131] (HELO m1.imap-partners.net) (64.13.152.131) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Feb 2009 23:46:01 +0000 Received: from [192.168.0.100] (c-24-21-96-139.hsd1.or.comcast.net [24.21.96.139]) by m1.imap-partners.net (MOS 3.10.3-GA) with ESMTP id BIM50245 (AUTH kent@iotabits.com) for derby-user@db.apache.org; Mon, 2 Feb 2009 15:45:38 -0800 (PST) Message-Id: <107FE9AC-26DF-46F1-8F90-8F7B11DC3CA7@iotabits.com> From: Kent Spaulding To: "Derby Discussion" In-Reply-To: <1668768631.18691233617606538.JavaMail.james@republika.nl> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Subject: Re: timestamp and Derby/Oracle? Mime-Version: 1.0 (Apple Message framework v930.3) Date: Mon, 2 Feb 2009 15:45:37 -0800 References: <1A524F70-F6D1-4613-BAD6-A459276FE8BD@iotabits.com> <1668768631.18691233617606538.JavaMail.james@republika.nl> X-Mailer: Apple Mail (2.930.3) X-Virus-Checked: Checked by ClamAV on apache.org Thanks, I've headed down that path and it looks much more promising, if not painful. --Kent On Feb 2, 2009, at 3:33 PM, Stephan van Loendersloot (LIST) wrote: > Kent Spaulding wrote: >> >> // assume INSERT_TIME is SQL type TIMESTAMP and FOO is type >> VARCHAR(100) >> >> INSERT into MY_TABLE (INSERT_TIME,FOO ) VALUES ( '2009-02-02 >> 14:28:08.81', 'foo value') >> >> Not a problem in Derby; but Oracle complains about the month not >> being valid. I expected Oracle to use the timestamp.toString() as >> input - how odd that it doesn't. >> >> > Hi Kent, > > Try something like this, it should work for all drivers: > > > > PreparedStatement pstmt = conn > .prepareStatement("INSERT into MY_TABLE (INSERT_TIME, FOO) values > (?, ?)"); > > pstmt.setTimestamp(1, ts); > pstmt.setString(2, foo); > > pstmt.executeUpdate(); > pstmt.close(); > > > > Regards, > > Stephan.