pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nico <haegens_nico@yahoo.com>
To: pgsql-jdbc@postgresql.org
Subject: sql action command doesn't work
Date: Fri, 21 Jan 2005 22:06:36 +0100
Message-ID: <csrqta$1q4r$1@news.hub.org> (raw)

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





Message-ID: <csrqta$1q4r$1@news.hub.org>
Permalink:  ../csrqta$1q4r$1@news.hub.org/
Also on:    postgresql.org/message-id/csrqta$1q4r$1@news.hub.org

 · 

reply

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: haegens_nico@yahoo.com
  Subject: Re: sql action command doesn't work
  In-Reply-To: <csrqta$1q4r$1@news.hub.org>
  References: <csrqta$1q4r$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