Skip site navigation (1) Skip section navigation (2)

resultset.first() untrappable error

From: kevin(at)mtel(dot)co(dot)uk (kevin)
To: pgsql-jdbc(at)postgresql(dot)org
Subject: resultset.first() untrappable error
Date: 2003-08-15 14:12:09
Message-ID: 6675f17.0308150612.29d987a7@posting.google.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
the following code frag has recently started bombing in a bean. It
produces no trappable error I can see (SQLException, Exception,
RuntimeException all fail) and is bombing at the ResultSet.first()
function call. Its using redhat 7.3 postgres jdbc pg73b1jdbcX jars.
The db is 7.3.2. jdk is sun
hotspot 1.41-b21. The sql works in a file with hard coded customer id.

	    query = "SELECT TO_CHAR(break,'MI9999990D99') as value," +
                    "       TO_CHAR(discount,'MI9999990D99') " +
                    "  FROM customer " +
                    " WHERE id='" + custid + "'" +
                    "   AND discount > 0 " +
                    " UNION " +
                    "SELECT TO_CHAR(value,'MI9999990D99')," +
                    "       TO_CHAR(discount,'MI9999990D99') " +
                    "  FROM discountbyvalue " +
                    " WHERE account='" + custid + "' " +
                    " ORDER BY value";

	    results = stmt.executeQuery(query);

             // only output discounts if there are some */
            if( ! results.first() ){
		results.close();
		stmt.close();
		return "";
	    }

Anybody got an idea why?

Responses

pgsql-jdbc by date

Next:From: Peter RoyalDate: 2003-08-15 15:13:28
Subject: Debugging I/O errors occured while reading from backend
Previous:From: Tom LaneDate: 2003-08-15 14:06:33
Subject: Re: CVS JDBC driver will try to use server-side-prepare on unpreparable SQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group