Avatar of Olukayode Oluwole
Olukayode Oluwole
Flag for Canada asked on

What would be the PostgreSQL database connection string equivalent for a known sqlserver connection string

I have a C# application that needs to connect to sqlserver and postgresql

I have been able to connect it to sqlserver and it works and the connection string is shown below

<add name="Tournaments" connectionString="Server=CHRISTINESPC;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>

I have tried a number of options for postgresql without success

Can anybody kindly help to specify what  the postgresql  connection string equivalent is


CHRISTINESPC is my servername as displayed in sqlserver  management studio thou I am open to using an IP address
Tournaments my Database name in both sqlserver and postgresql databases



Avatar of undefined
Last Comment
Dave Baldwin

8/22/2022 - Mon
slightwv (䄆 Netminder)

Not a Postgres Expert but connect strings are pretty available on the Web:
Olukayode Oluwole

I have actually tried the options i saw from that web site without success

I believe some one who has tried connecting  c#  to postgresql would

find this straight forward


David Favor

You asked...

What would be the PostgreSQL database connection string equivalent  for a known sqlserver connection string which seems odd.

SQL Server + PostgreSQL are two different products... Both are databases... so if this is your question, you can't...

If by known sqlserver connection string you really mean known PostgreSQL connection string... you state you have a working connection string already...

State the problem you're trying to solve coming up with a different connection string.
Your help has saved me hundreds of hours of internet surfing.
Olukayode Oluwole

Please read my very first post.

The question is how to get the postgresql connection string for a C# application

The example i gave was for connection of a C# application to sqlserver from my application

The issue is that i need the 2 connection strings (and currently only have 1 working)


O.A.  Oluwole
Dave Baldwin

Two questions:  1. Do you have the PostgreSQL driver installed on that system?  2. What is the error message you are getting?
Olukayode Oluwole

1. YES  I have postgresql 9.5 installed on my laptop and connects to it with a visual basic. application

2. The Connection string for  sqlserver and postgresql from my C# application  are as shown below

for sqlserver:

<add name="Tournaments" connectionString="Server=CHRISTINESPC;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>

with sqlserver connection my application runs

for postgresql:

<add name="Tournaments" connectionString="Server=;Port=5432;Database=Tournaments;Integrated Security=true;
" providerName="System.Data.SqlClient"/>

With postgresql i get the error  below:

System.ArgumentException: 'Keyword not supported: 'port'.'

Please note that in both case i use Dapper to effect connection.

What do you suggest i try


O.A.  Oluwole
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Dave Baldwin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question