From: | "Nico" <nicohmail-postgresql(at)yahoo(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | executeQuery returns postgresql.stat.result |
Date: | 2005-05-01 17:24:06 |
Message-ID: | d533ci$59s$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2005-05-01 17:32:26 | Re: executeQuery returns postgresql.stat.result |
Previous Message | Kris Jurka | 2005-04-30 09:59:58 | Re: Interval support for Postgres |