File tree 1 file changed +2
-4
lines changed
samples/mysql-schema/src/main/java/com/github/containersolutions/operator/sample
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> {
23
23
24
24
@ Override
25
25
public Optional <Schema > createOrUpdateResource (Schema schema ) {
26
- try {
27
- Connection connection = getConnection ();
26
+ try (Connection connection = getConnection ()) {
28
27
ResultSet resultSet = connection .createStatement ().executeQuery (
29
28
format ("SELECT schema_name FROM information_schema.schemata WHERE schema_name = \" %1$s\" " ,
30
29
schema .getMetadata ().getName ()));
@@ -61,8 +60,7 @@ public Optional<Schema> createOrUpdateResource(Schema schema) {
61
60
public boolean deleteResource (Schema schema ) {
62
61
log .info ("Execution deleteResource for: {}" , schema .getMetadata ().getName ());
63
62
64
- try {
65
- Connection connection = getConnection ();
63
+ try (Connection connection = getConnection ()) {
66
64
connection .createStatement ().execute ("DROP DATABASE `" + schema .getMetadata ().getName () + "`" );
67
65
log .info ("Deleted Schema '{}'" , schema .getMetadata ().getName ());
68
66
You can’t perform that action at this time.
0 commit comments