eva/3 Application BuilderDeveloping Additional eva/3 ComponentsUser CommandsExamples for Tasks of an CommandExamples for database commands 

Using prepared statements

The class DBUtils has two Methods to create a PreparedStatement from an ConnectionDescriptor: prepareStatement(String sql, ConnectionDescriptor connectionDescriptor) and PreparedStatement prepareStatement(QueryDescriptor queryDescriptor).

try
{
    ConnectionDescriptor con = ObjectLoader.getConnectionDescriptor("tables/example.connection");
    String sql = "UPDATE Kunden SET name = ? WHERE id = ?";
    PreparedStatement prep = DBUtils.prepareStatement(sql, con);
    prep.setString(1, "Miller");
    prep.setInt(2, 2638);
    int a = prep.executeUpdate();
    prep.close();
} catch (Exception e) {
    e.printStackTrace();
}