Reputation: 11
Question: - Need to connect to Postgresql using Npgsql using multiple connection string? - How does npgsql connect to Postresql? does it use JDBC dirvers?
Reason: Need for multiple connection string - For handling failover scenario where Primary DB server goes down and secondary / standby server become primary
Current libraries: - Npgsql(3.2.5) - Npgsql.EntityFrameworkCore.PostgreSQL (2.0.0) - Npgsql.EntityFrameworkCore.PostgreSQL.Design (1.1.1)
Looking forward for alternate approach
Upvotes: 1
Views: 251
Reputation: 16672
Specifying multiple hosts in the connection string isn't currently supported. It is tracked in this issue, and there's a high probability we'll do it for the next version. For now you'll have to implement it yourself, by catching connection exceptions from the first attempt and manually trying to connect to the second server.
Other than that, Npgsql is a pure .NET driver that has nothing to do with JDBC.
Upvotes: 2