diff --git a/src/sql/workbench/services/notebook/browser/sql/sqlSessionManager.ts b/src/sql/workbench/services/notebook/browser/sql/sqlSessionManager.ts index a5d54cf563..23a99b0710 100644 --- a/src/sql/workbench/services/notebook/browser/sql/sqlSessionManager.ts +++ b/src/sql/workbench/services/notebook/browser/sql/sqlSessionManager.ts @@ -331,8 +331,8 @@ class SqlKernel extends Disposable implements nb.IKernel { this._queryRunner.runQuery(code).catch(err => onUnexpectedError(err)); } else if (this._currentConnection && this._currentConnectionProfile) { this._queryRunner = this._instantiationService.createInstance(QueryRunner, this._connectionPath); + this.addQueryEventListeners(this._queryRunner); this._connectionManagementService.connect(this._currentConnectionProfile, this._connectionPath).then((result) => { - this.addQueryEventListeners(this._queryRunner); this._queryRunner.runQuery(code).catch(err => onUnexpectedError(err)); }).catch(err => onUnexpectedError(err)); } else {