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;
}
}