File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
samples/mysql-schema/src/main/java/com/github/containersolutions/operator/sample Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,7 @@ public class SchemaController implements ResourceController<Schema> {
2323
2424 @ Override
2525 public Optional <Schema > createOrUpdateResource (Schema schema ) {
26- try {
27- Connection connection = getConnection ();
26+ try (Connection connection = getConnection ()) {
2827 ResultSet resultSet = connection .createStatement ().executeQuery (
2928 format ("SELECT schema_name FROM information_schema.schemata WHERE schema_name = \" %1$s\" " ,
3029 schema .getMetadata ().getName ()));
@@ -61,8 +60,7 @@ public Optional<Schema> createOrUpdateResource(Schema schema) {
6160 public boolean deleteResource (Schema schema ) {
6261 log .info ("Execution deleteResource for: {}" , schema .getMetadata ().getName ());
6362
64- try {
65- Connection connection = getConnection ();
63+ try (Connection connection = getConnection ()) {
6664 connection .createStatement ().execute ("DROP DATABASE `" + schema .getMetadata ().getName () + "`" );
6765 log .info ("Deleted Schema '{}'" , schema .getMetadata ().getName ());
6866
You can’t perform that action at this time.
0 commit comments