例如
public void invoke(String value, SinkFunction.Context context) throws SQLException {
statement_.execute("INSERT INTO test (column_1) VALUES '"+value"');
}
如何正确插入值?
获得连接后,执行以下操作:
String sql = "INSERT INTO test (column_1) VALUES (?)";
PreparedStatement statement = connection.prepareStatement(sql);
statement.setString(1, value);
statement.addBatch();
statement.executeBatch();