Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YCA7L-0004RC-Ec for pgsql-jdbc@arkaria.postgresql.org; Fri, 16 Jan 2015 16:51:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YCA7K-0007Us-UN for pgsql-jdbc@arkaria.postgresql.org; Fri, 16 Jan 2015 16:51:26 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YCA7K-0007SE-5I for pgsql-jdbc@postgresql.org; Fri, 16 Jan 2015 16:51:26 +0000 Received: from outbound.vnet-inc.com ([216.146.104.103]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YCA7G-0001A1-9s for pgsql-jdbc@postgresql.org; Fri, 16 Jan 2015 16:51:23 +0000 Received: from [192.168.157.52] (unknown [65.19.243.151]) by outbound.vnet-inc.com (Postfix) with ESMTP id 9845375FC; Fri, 16 Jan 2015 09:51:01 -0700 (MST) Message-ID: <54B9433B.6070706@ttc-cmc.net> Date: Fri, 16 Jan 2015 09:58:35 -0700 From: dmp User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0 SeaMonkey/2.21 MIME-Version: 1.0 To: Vinayak , PostgreSQL JDBC Subject: Re: Problem with DATE References: <1420546864196-5833008.post@n5.nabble.com> <1421061400959-5833623.post@n5.nabble.com> <1421123270940-5833702.post@n5.nabble.com> <1421131374401-5833708.post@n5.nabble.com> <1421213697306-5833860.post@n5.nabble.com> <1421386506791-5834215.post@n5.nabble.com> In-Reply-To: <1421386506791-5834215.post@n5.nabble.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Vinayak wrote: > Hi Dave, > Thank you for explanation. > > I understood that the behavior of date is different in PostgreSQL and Java. > PostgreSQL DATE type return date part only. > Java DATE return date and time with timezone. >> I am guessing what you really want is to just take the date in your Oracle > db, load it into java and store >it into postgresql without any > transformation. >> This would require a custom date type. > I have created custom date type which return date and time in PostgreSQL. > postgres=# select now()::date; > now > --------------------------------- > 2015-01-16 10:51:41 > (1 row) > but still PreparedStatement throws error for date parameter. > > ----- > Regards, > Vinayak, Hello, If you are able to perform the conversion of the Oracle Date to a java.sql.Date type then perhaps instead of trying to force this into a setObject() statement have you just tried setDate()? The code you have shown works fine with my application, but not as setObject() if (columnType.equals("DATE")) { java.sql.Date dateValue; dateString = MyJSQLView_Utils.convertViewDateString_To_DBDateString( dateTimeFormString,DBTablesPanel.getGeneralDBProperties().getViewDateFormat()); dateValue = java.sql.Date.valueOf(dateString); prepared_sqlStatement.setDate(i++, dateValue); } I know you have said that you do not wish to change your code throughout, but this may be the easist approach rather then rewriting the driver. You might have already changed the code in a day's work. danap. MyJSQLView Project Manager dandymadeproductions.com -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc