0
votes

Hello I'm trying to run a query in my webservice, but a function that a query is within breaks from nothing.

My code:

public boolean excluir(String usuario)
{
String sql = "DELETE * FROM listaproduto where uclogin=?";
Boolean retorno = false;
PreparedStatement pst = Conexao.getPreparedStatement(sql);
try {
    pst.setString(1, usuario); //He breaks that part.
    if(pst.executeUpdate()>0)
    {
        retorno = true;
    }
} catch (SQLException ex) {
    Logger.getLogger(ProdutoDAO.class.getName()).log(Level.SEVERE, null, ex);
    retorno = false;
}
return retorno;
} 

Error:

GET SolicitaçãoFailed RequestFailed --> Status: (500) Resposta: { HTTP Status 500 - Internal Server Error

type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: java.lang.NullPointerException

root cause

java.lang.NullPointerException

note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1.1 logs. GlassFish Server Open Source Edition 4.1.1

1
Start it in debug mode and set a break point and step through the code. - Namphibian

1 Answers

0
votes
String sql = "DELETE FROM listaproduto where uclogin=?";

Delete your '' and then, try it again.. I think that delete method does not need ''.. Hope this can help you :)