X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D33949DC809 for ; Wed, 1 Feb 2006 12:21:01 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 78307-03 for ; Wed, 1 Feb 2006 12:20:59 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 2B7489DC803 for ; Wed, 1 Feb 2006 12:20:59 -0400 (AST) Received: from a.relay.invitel.net (a.relay.invitel.net [62.77.203.3]) by svr4.postgresql.org (Postfix) with ESMTP id B19D75AF8B5 for ; Wed, 1 Feb 2006 16:20:58 +0000 (GMT) Received: from mail.invitel.hu (mail.vnet.hu [213.163.59.4]) by a.relay.invitel.net (Invitel Core SMTP Transmitter) with ESMTP id 0B32B1106F0 for ; Wed, 1 Feb 2006 17:20:52 +0100 (CET) Received: from [10.3.3.106] ([83.216.43.74]) by mail.invitel.hu (Invitel Messaging Server) with ESMTPA id <0IU0002T8O0QKUI0@invitel.hu> for pgsql-jdbc@postgresql.org; Wed, 01 Feb 2006 17:19:38 +0100 (CET) Date: Wed, 01 Feb 2006 17:20:49 +0100 From: =?ISO-8859-2?Q?Papp_M=E1rton?= Subject: timestamp parameter is null To: pgsql-jdbc@postgresql.org Message-id: <43E0DFE1.9020200@assixo.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-2; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200602/6 X-Sequence-Number: 14603 Hello List! I have the following problem: I'm trying to execute a simple SQL query with JDBC and I get an exception, which I don't understand why. Here's the code: public static void main(String[] args) throws Exception { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5434/dbname", "user", "pass"); PreparedStatement stm = conn.prepareStatement("select * from tablename where ? is not null"); stm.setTimestamp(1, new Timestamp(new Date().getTime())); stm.executeQuery(); } The exception is: Exception in thread "main" org.postgresql.util.PSQLException: ERROR: could not determine data type of parameter $1 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:250) at Test6.main(Test6.java:15) The server version is 8.1.0. The Jdbc driver is postgresql-8.1-404.jdbc3.jar. The same code runs fine with the 7.4 jdbc driver. It's also okay, if I'm using any other type than timestamp. Actually, I tried "string" and it worked. I wonder what the problem is. Marci