Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection string: Database names with spaces and surrounding double-quotes do not get treated right anymore #605

Closed
andrehartmann1968 opened this issue Feb 19, 2023 · 4 comments
Assignees
Labels
bug investigating Issue is under investigation

Comments

@andrehartmann1968
Copy link

andrehartmann1968 commented Feb 19, 2023

Issue description

What should happen: When my connection string contains something like DB="Development DB" (i.e. a database name with a spacve in it and surrounding double-quotes), a login request URL is supposed to formed that matches this: ...&databaseName="Development+DB"&...

What happens instead: This used to work up until commit 6df38a7 (17 Oct 2022, "fix 00402816 escape characters issue. (#531)"). That commit changed the parsing of the connection string by now using the DbConnectionStringBuilder. I am sure this was well-intended but it will swallow the surrounding double-quotes. The resulting login request URL is now: ...&databaseName=Development+DB&... (no double-quotes). Snowflake responds to that by saying "Error: The requested database does not exist or not authorized. SqlState: 08006, VendorCode: 390201"

The same problem exists for all tokens in the connection string. DB is just one example. You can also try with the warehouse, the role, ....

Example code

var connectionString = "scheme=https;ACCOUNT=bla;HOST=bla.snowflakecomputing.com;port=443;ROLE=\"bla\";WAREHOUSE=\"bla\";USER=bla;DB=\"Development DB\";SCHEMA=\"bla\"";
var connection = new SnowflakeDbConnection
{
	ConnectionString = connectionString,
	Password = new NetworkCredential("", "bla").SecurePassword
};
connection.Open();

Configuration

Dotnet framework and version: .NET 6

  • Client OS: Irrelevant. Windows 10 as well as AWS Lambda Linux
@sfc-gh-spanaite sfc-gh-spanaite self-assigned this Apr 6, 2023
@sfc-gh-spanaite sfc-gh-spanaite added the status-triage Issue is under initial triage label Apr 6, 2023
@sfc-gh-spanaite
Copy link

Hi @andrehartmann1968 , thanks for reporting this. I am able to reproduce the behavior and I can see this was introduced in version 2.0.18. Looks like a bug, but we'll confirm.

@sfc-gh-spanaite sfc-gh-spanaite added investigating Issue is under investigation and removed status-triage Issue is under initial triage labels Apr 6, 2023
@sfc-gh-igarish
Copy link
Collaborator

Fix released in .net driver v2.0.23

@andrehartmann1968
Copy link
Author

Fix released in .net driver v2.0.23

You may have fixed this for the database, but other tokens like the role and the warehouse also support spaces in their names. Even with the current version 3.0.0 this does not work. I still cannot upgrade the usage of the package beyond 2.0.17 because of this phenomenon. Could you please re-open this and fix it once and for good?

@sfc-gh-dszmolka
Copy link
Contributor

thank you - handling the remaining issue on #888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug investigating Issue is under investigation
Projects
None yet
Development

No branches or pull requests

4 participants