public Connection getConnection(DBConnectionSupplier connectionSupplier) throws SQLException {

		// Use task to establish initial connection
		DBConnectTask connectTask = new DBConnectTask(connectionSupplier);
		try {
			//@formatter:off
            TaskBuilder.withTask(connectTask)
                .setTitle("BSim DB Connection...")
                .setCanCancel(false)
                .setHasProgress(false)
                .launchModal();
            //@formatter:on    

			synchronized (BSimDBConnectTaskCoordinator.this) {
				Connection c = connectTask.getConnection();
				if (c != null) {
					return c;
				}

				if (isCancelled) {
					throw new CancelledSQLException("Password entry was cancelled");
				}
				if (exc instanceof SQLException e) {
					throw e;
				}
				if (exc instanceof RuntimeException e) {
					throw e;
				}
				throw new RuntimeException(exc);
			}
		}
		finally {
			synchronized (BSimDBConnectTaskCoordinator.this) {
				if (--count == 0) {
					clear();
				}
			}
		}
	}
Initiate a DB connection.
@param connectionSupplier DB connection supplier
@return DB connection
@throws SQLException if a database connection error occured
@throws CancelledSQLException if task was cancelled (password entry cancelled)
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/BSimDBConnectTaskCoordinator.java