Por favor alguem teria os erros do derby para inserir, remover, criar, excluir, recuperar, atualizar?
Tenho q fazer uma aplicação q rode tanto no oracle quando no derby…
Mais não consegui instalar o derby na maquina…
Só consegui fazer pelo oracle mesmo.
Exemplo:
public RetornoAcao atualizarTumulo(List<Object> lista)
{
Connection con = null;
try {
con = Conexao.obterConexao();
Statement stmt = con.createStatement();
Integer codigo = (Integer) lista.get(0);
String nome = (String) lista.get(1);
Integer x = (Integer) lista.get(2);
Integer y = (Integer) lista.get(3);
Integer qtde = (Integer) lista.get(5);
String sql = "update tumulos " +
"set nome='" + nome + "', " +
"posicaoX=" + x + ", " +
"posicaoY=" + y + ", " +
"qtde=" + qtde + " " +
"where codigo_lote=" + codigo;
int update = stmt.executeUpdate(sql);
if (update != 1)
return new RetornoAcao(false,"Dados em branco, favor preeencher os campos.");
return new RetornoAcao(true,"Dado atualizado com sucesso");
} catch (SQLException e) {
//qual a exceção que eu coloco aqui
//q pelo oracle é só colocar
/**
if(e.getSQLState().equals("42000"))
return new RetornoAcao(false,"Tabela não existe para atualizar dado");
if((e.getSQLState().equals("23000")) || (e.getErrorCode() == 1400))
return new RetornoAcao(false,"Erro para atualizar dado");
*/
throw new RuntimeException("Erro ao atualizar dado", e);
} finally {
Conexao.fecharConexao(con);
}
}
Grata deste já.
!