New versions: Dev (3.14) | Latest (3.13) | 3.12 | 3.11

The GRANT statement

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Databases that implement access control for their database catalog allow for using GRANT and REVOKE privileges from org.jooq.User and org.jooq.Role objects. In jOOQ, this can be done as follows:

// Define privileges
Privilege select = privilege("select");
Privilege insert = privilege("insert");
User user = user("user");

// Grant privileges to a given user or role
create.grant(select, insert).on(BOOK).to(user).execute();

// Grant privileges to a given user or role with the grant option
create.grant(select, insert).on(BOOK).to(user).withGrantOption().execute();

// Grant privileges to everyone
create.grant(select, insert).on(BOOK).toPublic().execute();
The jOOQ Logo