From: | "Nico" <haegens_nico(at)yahoo(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | sql action command doesn't work |
Date: | 2005-01-21 21:06:36 |
Message-ID: | csrqta$1q4r$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hello, I have a servlet that generates a menu from a database. Now I am
developping one that can change the data in that database via a web
interface. However, when I do a executeUpdate it doesn't work. It doesn't
give an error, it does just nothing. That's what's so strange. Anybody any
suggestions?
Nico.
Here is the method that handles it:
protected static ResultSet getQuery(String strstatement, Statement
statement)
throws SQLException, DriverNotFoundException, ConnectionException
{
if(strstatement==null)
throw new SQLException("strstatement is null.");
if(connection==null)
{
connect(strDbdriver, "getQuery");
if(connection==null)
throw new menus.ConnectionException(strDbdriver,
"getQuery","connection is null.");
if(statement==null)
statement=connection.createStatement();
}
if(statement==null)
{
throw new SQLException("statement is null.");
}
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 Error getQuery(): "+errmessage);
}
}
else
{
statement.executeUpdate(strstatement);
return null;
}
}
From | Date | Subject | |
---|---|---|---|
Next Message | Nico | 2005-01-22 13:03:40 | Relation "autonummeringl2" does not exist |
Previous Message | Franco Bruno Borghesi | 2005-01-21 20:14:56 | Re: [JDBC] Schema? |