Skip to content

Commit 87eeda0

Browse files
Fixes #47 - Close unshared connections
1 parent 1b14205 commit 87eeda0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sqldev/src/main/java/org/utplsql/sqldev/UtplsqlWorksheet.xtend

+8-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ class UtplsqlWorksheet {
4343

4444
private def setConnection(String connectionName) {
4545
if (connectionName !== null && preferences.unsharedWorksheet) {
46-
this.connectionName = Connections.instance.createPrivateConnection(connectionName)
46+
// fix for issue #47 - private connections are not closed in SQLDev >= 17.4.0
47+
try {
48+
// temporary connection is closed when worksheet is closed, but requires SQLDev >= 17.4.0
49+
this.connectionName = Connections.instance.createTemporaryConnection(connectionName)
50+
} catch (Throwable e) {
51+
// private connection is closed when worksheet is closed in SQLDev < 17.4.0
52+
this.connectionName = Connections.instance.createPrivateConnection(connectionName)
53+
}
4754
} else {
4855
this.connectionName = connectionName;
4956
}

0 commit comments

Comments
 (0)