Skip to content

fix: connection failure in Azure SQL Data Warehouse - #643

Merged
arthurschreiber merged 1 commit into
tediousjs:masterfrom
Suraiya-Hameed:datawarehouse-support
Nov 10, 2017
Merged

arthurschreiber merged 1 commit into
tediousjs:masterfrom
Suraiya-Hameed:datawarehouse-support

Conversation

@Suraiya-Hameed

Copy link
Copy Markdown
Member

Connection to Azure SQL Data Warehouse fails with ERROR: 'CursorCloseOnCommit' is not a recognized option.
Cursor_close_on_commit is not supported by DW, since this is OFF by default, if user doesn't set it in config, avoid sending it in initial SQL.

https://docs.microsoft.com/en-us/sql/t-sql/statements/set-cursor-close-on-commit-transact-sql

Fixes #631

CURSOR_CLOSE_ON_COMMIT is not supposted by Data Warehouse, making it optional. Tedious was setting it to false by default, but it is off in Server by default, so no need to send it again.

https://docs.microsoft.com/en-us/sql/t-sql/statements/set-cursor-close-on-commit-transact-sql

@arthurschreiber arthurschreiber left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is great - and so simple. I love it! 😍

@arthurschreiber
arthurschreiber merged commit 32cd414 into tediousjs:master Nov 10, 2017
@arthurschreiber

arthurschreiber commented Nov 10, 2017 •

Copy link
Copy Markdown
Collaborator

Once the current build on master finishes, this should be automatically released as [email protected]. 🎉

@arthurschreiber

Copy link
Copy Markdown
Collaborator

Now that I merged and released this, I'm wondering whether this is truly the right fix here. 😅

If I understand https://docs.microsoft.com/en-us/sql/t-sql/statements/set-cursor-close-on-commit-transact-sql correctly, the server wide value for cursor_close_on_commit can be changed from the default false value. So if someone would do that, there would not be any way to set this value to false again on login.

This is not something we need to fix now, but should revisit some time later in the future.

@v-suhame What do you think?

@Suraiya-Hameed

Suraiya-Hameed commented Nov 10, 2017 •

Copy link
Copy Markdown
Member Author

We sure need to fix that, sorry, my bad, I should have tested that 😞

@Suraiya-Hameed

Copy link
Copy Markdown
Member Author

How about setting this.config.options.enableCursorCloseOnCommit as undefined by default,
and in getInitialSql()

getInitialSql() {
 ..
    const getCursorCloseOnCommit = () => {
      if (this.config.options.enableCursorCloseOnCommit === undefined)
        return '';
      else
        return 'set cursor_close_on_commit ' + (this.config.options.enableCursorCloseOnCommit ? 'on' : 'off') + '\n';
    };

...
return `...
${getCursorCloseOnCommit ()}
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connection failure - Azure SQL Data Warehouse

2 participants