Connection string in .NET
Hey! Trying to connect to neon from a .NET application. I figured using Npgsql would be the happy path since it is a PostgreSQL database, but I can't quite figure out how I should form my connection string. Seems like there aren't a lot of .NET people using Neon yet, so no guide up on the website, but I wouldn't mind writing up a first draft for a language guide on .NET.
Right now I'm just passing what I was provided in the "connection string" field but I'm getting an error from Npgsql,
Format of the initialization string does not conform to specification starting at index 0.
This is what I am passing:
3 Replies
wise-whiteOP•2y ago
I found in the Npgsql docs that a host is required, and that connection strings need to be in the form of
keyword1=value; keyword2=value;
https://www.npgsql.org/doc/connection-string-parameters.html#basic-connection
But I'm still not sure on how I would build this out correctly (what is a keyword in the connection string I am given by neon, and what is a value?)
I'm assuming since it doesn't see a capital H for Host= as the first character it immediately dislikes it
Just figured it out, this helped: https://ptb.discord.com/channels/1176467419317940276/1200360273295462421/1200360273295462421
adverse-sapphire•2y ago
Hi, wondering if these might help:
https://github.com/danieltprice/postgres-connection-examples/tree/main/csharp/Npgsql
https://community.neon.tech/t/how-can-i-connect-from-entityframework-on-c/373
If you want to add a guide, that would be great. I can assist with that if you have any questions.
GitHub
postgres-connection-examples/csharp/Npgsql at main · danieltprice/p...
PostgreSQL Connection Examples. Contribute to danieltprice/postgres-connection-examples development by creating an account on GitHub.
Neon
How can I connect from entityframework on c#?
Hello, I’m trying to connect from entity framework on c#. I 'm getting following error. I checked my password and user name is true. I didn’t find any form for my ip address to adding safe ip address. How can I connect mydb from local computer? CXX000: password authentication failed for user ‘myusername’ Best Onder
adverse-sapphire•2y ago
oh, after I posted I saw that you already figured it 🙂