From: | Dave Cramer <Dave(at)micro-automation(dot)net> |
---|---|
To: | Henri Chen <henri_chen(at)yahoo(dot)com> |
Cc: | "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: setObject() throw exception message: "The table for |
Date: | 2003-04-01 09:55:57 |
Message-ID: | 1049190956.1106.72.camel@inspiron.cramers |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Henri,
Internally, the driver doesn't know anything about Date type, just
change your code to
stmt.setTimestamp( new Timestamp( beginDate) ) ...
and it should work
On Mon, 2003-03-31 at 22:39, Henri Chen wrote:
> Hi, did someone on the net hit such exception?
>
> 1. The exception stack:
>
> The table for java.util.Date is not in the database. Contact the DBA, as the database is in an inconsistent state.
> at org.postgresql.jdbc1.AbstractJdbc1Connection.storeObject(AbstractJdbc1Connection.java:753)
> at org.postgresql.jdbc1.AbstractJdbc1Statement.setObject(AbstractJdbc1Statement.java:1470)
> at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.setObject(LocalPreparedStatement.java:625)
> ....<snip/>
>
> 2. The java program snip:
>
> String script = "SELECT MAX(\"id\") FROM \"vEntry\" WHERE \"when\" BETWEEN ? AND ?";
> PreparedStatement stmt = conn.prepareStatement(script,
> ResultSet.TYPE_FORWARD_ONLY,
> ResultSet.CONCUR_READ_ONLY);
> stmt.setObject(1, beginDate); //<------------ exception occured at this line
> stmt.setObject(2, endDate);
>
> 3. I have tried rewrite the sql script to
> SELECT MAX("id") FROM "vEntry" WHERE "when" >= ? AND "when" <= ?
>
> and it works without problem.
>
> 4. Oh, and vEntry is a VIEW.
>
> 5. Environment
> Win2k, service pack 3
> cygwin.dll version: 1.3.17
> postgresql 7.3-1
> postgresql.jar 2003/3/23
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
>
> Can some gurus out there help me on this?
>
> Henri Chen
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
--
Dave Cramer <Dave(at)micro-automation(dot)net>
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Cramer | 2003-04-01 18:59:33 | Re: I can't connect to a database from application |
Previous Message | Henri Chen | 2003-04-01 05:05:45 | FW: setObject() throw exception message: "The table for java.util.Date is not in the database. ..." |