From: Nico <nicohmail-postgresql@yahoo.com>
To: pgsql-jdbc@postgresql.org
Subject: executeQuery returns postgresql.stat.result
Date: Sun, 1 May 2005 19:24:06 +0200
Message-ID: <d533ci$59s$1@news.hub.org> (raw)
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: nicohmail-postgresql@yahoo.com
Subject: Re: executeQuery returns postgresql.stat.result
In-Reply-To: <d533ci$59s$1@news.hub.org>
References: <d533ci$59s$1@news.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox