executeQuery returns postgresql.stat.result

Поиск
Список
Период
Сортировка
От Nico
Тема executeQuery returns postgresql.stat.result
Дата
Msg-id d533ci$59s$1@news.hub.org
обсуждение исходный текст
Ответы Re: executeQuery returns postgresql.stat.result  (Kris Jurka <books@ejurka.com>)
Список 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 по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: Interval support for Postgres
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: executeQuery returns postgresql.stat.result