Skip site navigation (1) Skip section navigation (2)

sql action command doesn't work

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 (view raw or flat)
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;
        }
    }



pgsql-jdbc by date

Next:From: NicoDate: 2005-01-22 13:03:40
Subject: Relation "autonummeringl2" does not exist
Previous:From: Franco Bruno BorghesiDate: 2005-01-21 20:14:56
Subject: Re: [JDBC] Schema?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group