X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 7C4649FB521 for ; Fri, 25 Aug 2006 05:41:26 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 69938-07 for ; Fri, 25 Aug 2006 08:41:21 +0000 (UTC) X-Greylist: delayed 00:11:13.712634 by SQLgrey- Received: from mail-03.jhb.wbs.co.za (mail-03.jhb.wbs.co.za [196.2.97.2]) by postgresql.org (Postfix) with ESMTP id B45CB9FB4DA for ; Fri, 25 Aug 2006 05:41:20 -0300 (ADT) Received: from mail-01.jhb.wbs.co.za ([196.30.31.196]) by mail-03.jhb.wbs.co.za with ESMTP; 25 Aug 2006 10:29:56 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AQAAAPZQ7kSLKQEBCQ4q Received: from wbs-196-2-104-205.wbs.co.za ([196.2.104.205] helo=[192.168.0.49]) by mail-01.jhb.wbs.co.za with esmtp (Exim 4.50) id 1GGX4a-0006Sx-57 for pgsql-jdbc@postgresql.org; Fri, 25 Aug 2006 10:29:57 +0200 Message-ID: <44EEB4F4.2050202@bbd.co.za> Date: Fri, 25 Aug 2006 10:29:40 +0200 From: Vincent Risi User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Could not determine data type of parameter $1 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Original-Subject: Could not determine data type of parameter $1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200608/140 X-Sequence-Number: 15667 //////////////////////////// Using the version of the jbdc drive (postgresql-8.1dev-400.jdbc3.jar) instead of (postgresql-8.1-407.jdbc3.jar) the code below works. I would like to know if the code is valid or if the driver has a problem. It fails at ResultSet result = prepared.executeQuery(); //////////////////////////// ======================== Extract from DataHandler ======================== ... import java.text.SimpleDateFormat; public static SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyyMMddHHmmss"); public static java.sql.Timestamp dateTime(String value) throws Throwable { if (value.length() == 8) value += "000000"; java.util.Date date = dateTimeFormat.parse(value); return new java.sql.Timestamp(date.getTime()); } ================================== Extract from inherited data record ================================== ... public String cashier; public String terminalId; public String actionDateFrom; public String actionDateTo; public double receiptTotal; public double removalTotal; ========================================= Function or method where the error occurs ========================================= ... public boolean pettyCash() throws Throwable { String statement = "select CashierUserid, CashierTerminalId, ?, ?, 0, sum(CashierTotalRemoved) " +_EOL_+ "from ReceiptRemoval " +_EOL_+ "where RemovalType = 'P' " +_EOL_+ "and CashierUserid = ? " +_EOL_+ "and CashierTerminalId = ? " +_EOL_+ "and ActionDate > ? " +_EOL_+ "and ActionDate <= ? " +_EOL_+ "group by CashierUserid, CashierTerminalId " ; PreparedStatement prepared = connector.prepareStatement(statement); prepared.setTimestamp(1, DataHandler.dateTime(actionDateFrom)); prepared.setTimestamp(2, DataHandler.dateTime(actionDateTo)); prepared.setString(3, cashier); prepared.setString(4, terminalId); prepared.setTimestamp(5, DataHandler.dateTime(actionDateFrom)); prepared.setTimestamp(6, DataHandler.dateTime(actionDateTo)); ResultSet result = prepared.executeQuery(); ResultSetMetaData _rsmd_ = result.getMetaData(); int _columns_ = _rsmd_.getColumnCount(); if (_columns_ != 6) throw new Exception("Columns Read="+_columns_+" != Expected=6"); if (!result.next()) { result.close(); prepared.close(); return false; } cashier = result.getString(1); terminalId = result.getString(2); actionDateFrom = DataHandler.dateTime(result.getTimestamp(3)); actionDateTo = DataHandler.dateTime(result.getTimestamp(4)); receiptTotal = result.getDouble(5); removalTotal = result.getDouble(6); result.close(); prepared.close(); return true; } ///////////////////////////////////