executeQuery returns postgresql.stat.result - Mailing list pgsql-jdbc

From Nico
Subject executeQuery returns postgresql.stat.result
Date
Msg-id d533ci$59s$1@news.hub.org
Whole thread Raw
Responses Re: executeQuery returns postgresql.stat.result
List pgsql-jdbc
Hi,
When I try
        try
        {
            sql="select * from \"qryMonthsYears\"";
            java.sql.ResultSet
resultset=getQuery(sql,connection.createStatement());
        }
        catch(java.sql.SQLException fout)
        {
            java.sql.SQLException foutje=fout.getNextException();
            out.println("<br>SQL fout: "+fout.getMessage());
            while(foutje!=null)
            {
                out.print("<br>Ingebedde fout: "+foutje.getMessage());
                foutje=fout.getNextException();
            }
        }

I get the following exception when I try this:
 Batch entry 0 select * from "qryMonthsYears"; was aborted. Call
getNextException() to see the cause.
When I call getNextException(), I get the following result:
postgresql.stat.result
and stays in the loop.
Here is the code for the method getQuery:
        ResultSet resultset;
        if(strstatement.startsWith("SELECT"))
        {
            resultset=statement.executeQuery(strstatement);
            if(resultset==null)
                throw new SQLException("Resultset is null at getQuery().");
            if(resultset.getWarnings()==null)
                return resultset;
            else
            {
                String errmessage="";
                while(resultset.getWarnings().getErrorCode()!=0)
                {
                    errmessage+=resultset.getWarnings().getMessage()+"\n";
                    resultset.getWarnings().getNextException();
                }
                throw new SQLException("SQL Fout getQuery(): "+errmessage);
            }
        }
        else
        {
            connection.setAutoCommit(false);
            String [] sql=strstatement.split(";");
            for(int teller=0;teller<sql.length;teller++)
                statement.addBatch(sql[teller]+";");
            statement.executeBatch();
            connection.commit();
            connection.setAutoCommit(true);
            return null;
        }

Please help!

Nico.



pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Interval support for Postgres
Next
From: Kris Jurka
Date:
Subject: Re: executeQuery returns postgresql.stat.result