commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <lionspirit1976-li...@yahoo.com.br>
Subject Commons DbUtils - insert, update and delete commands
Date Mon, 16 Oct 2006 17:49:01 GMT
Anyone knows a way to execute a insert, update or delete command using Commons DbUtils and
just passing the object ? Or the best feature is to convert the resultset in a list of objects
?

Using SqlStrings is not much simplier than using PreparedStatement

public static void updateteste() {
        try {
            ConexaoSql.getInstance();
            prepstatement = 
                conexao.prepareStatement(
                        "UPDATE usuario SET NOME = ? WHERE LOGIN = ?;");
            prepstatement.setString(1,"Teste");
            prepstatement.setString(2,"afre");
            prepstatement.executeUpdate();
        } catch (SQLException e) {e.printStackTrace();}
        destroy();
    }
 
Olivier Jeanpierre Voutat
Rua Praia de Muriú, 9188
Cep 59092-390 / Natal - RN
Tel: (84) 3219-0427 Cel: (84) 9977-3917


 		
---------------------------------
 Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho
agora!
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message