Describe the bug
Trying to connect to any Azure SQL server instance fails with the exception:
Error: Request connection/openConnection failed with message: Requests can only be made in the LoggedIn state, not the LoggedInSendingInitialSql state
at handleResponse (C:\Users\ran\.vscode\extensions\mtxr.sqltools-0.16.7\node_modules\vscode-jsonrpc\lib\main.js:436:48)
at processMessageQueue (C:\Users\ran\.vscode\extensions\mtxr.sqltools-0.16.7\node_modules\vscode-jsonrpc\lib\main.js:263:17)
at Immediate.setImmediate [as _onImmediate] (C:\Users\ran\.vscode\extensions\mtxr.sqltools-0.16.7\node_modules\vscode-jsonrpc\lib\main.js:247:13)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A connection is established, Assuming all details (URL, username, password etc) are correct.
Desktop (please complete the following information):
Example configured connection:
{
"server": "MYSERVERHERE.database.windows.net",
"name": "PROD DB",
"askForPassword": true,
"dialect": "MSSQL",
"dialectOptions": {
"encrypt": true
},
"database": "DB-NAME",
"port": 1433,
"username": "myAzureSQLAdminUser"
}
Hi @ransagy.
I'll take a look. For version 0.16.7 I've upgrade some libraries, including the one for SQL Server.
Do you use any other server there? Even if it's for other dialects like MySQL.
Thanks for reporting this shortly.
Also, do you have this connection set to autoConnectTo?
@mtxr thank you for the quick response!
While this allowed me to move forward, It still didn't work. Despite having "encrypt": true in my dialect options as noted above, I still get the following error in the log:
(node:17028) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): ConnectionError: Server requires encryption, set 'encrypt' config option to true.
I'll reopen and take a second look into it
Just to keep you up to date, this warning is probably because of this:
Since the "encrypt" flag is a now issue because of miss configuration, I've decided to do a retry if fail and try without encryption.
As far as i know, Connections to Azure SQL have to be encrypted. Usually when specififying connection strings elsewhere, like in .NET, i have to supply the ;Trusted_Connection=False;Encrypt=True; parameters.
I think encrypt is enough though.
I'll test it again as soon as there's a release.
Confirmed, Works well now. Thanks!
Most helpful comment
Confirmed, Works well now. Thanks!