DSLContextusually not a resource, so you can leave it "open", i.e. You can let the garbage collector collect it for you.
JDBC Connection, , , , , . Java 7+ try-with-resources:
static void methodA() {
try (Connection con = MySQLConnection.getConexion()) {
DSLContext ctx = DSL.using(con, SQLDialect.MYSQL);
}
}
try-with-resources . , jOOQ try-with-resources JDBC.
DSLContext ?
, DSLContext Connection, . URL- :
try (DSLContext ctx = DSL.using("jdbc:url:something", "username", "password")) {
}
close() DSLContext,