Relational databases watermarking aims at protecting the intellectual or industrial property of a dataset, by applying secret and slight alterations on it. When critical usability constraints of this dataset must be preserved, finding such alterations (watermarks) is a difficult computational task, which is not optimized by the current watermarking systems. This is a critical limitation when considering <i>fingerprinting</i> applications, where several distinct watermarked databases have to be obtained.An important property of the watermark is to be resilient to attacks that try to erase it. Among these attacks, one of the most severe is the <i>collusion attack</i>, that locates the watermark by comparing several distinct watermarked versions of a database. Such an attack has not been taken into account by the existing databases watermarking methods, when usability constraints have to be preserved.In this paper, we present an efficient algorithm for collusion-secure fingerprinting that preserves usability constraints. We identify a class of constraints, namely <i>weight-independent constraints</i>, that can be translated into an integer linear program. Solutions of this program are acceptable watermarks. This representation is computed once and for all and has the following advantages. First, we can rely on state-of-the-art optimizers to reduce the search space and quickly find a good watermark. Second, for a carefully chosen class of watermarks, producing every new watermark is immediate, compared with the complete recomputation needed by existing watermarking methods. Finally, our algorithm addresses the problem of collusion attacks, by making possible the use of collusion-secure codes while respecting usability constraints.The formalism of this article permits to handle both relational databases and XML documents. The effectiveness of our techniques has been established on our open platform <i>Watermill</i>, that integrates fingerprinting management capabilities to standard relational or XML-native databases systems.