PostgreSQL connection problem.

Mar 19, 2016 at 2:15 PM
I'm using FluentData version 3.0.1.0. I've postgresql version 9.x with Npgsql 3.0.5.0.
I've added that configuration, ProviderFactory to my console application App.config.

<system.data>
<DbProviderFactories>
<add name="Npgsql Data Provider"
     invariant="Npgsql"
     support="FF"
     description=".Net Framework Data Provider for Postgresql Server"
     type="Npgsql.NpgsqlFactory, Npgsql" />
</DbProviderFactories>
</system.data>

tried also,

<system.data>
<DbProviderFactories>
  <add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Version=3.0.5.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" support="FF" />
</DbProviderFactories>
</system.data>

The connection string format is:
<connectionStrings>
<add name="TargetDb" connectionString="Server=localhost;Port=5432;User Id=*****;Password=******;Database=ReportTest"/>
</connectionStrings>

Trying to connect PostgreSql how ever I got the following exception.
Unhandled Exception: System.ArgumentException: Keyword not supported: 'port'.   at System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey)

   at System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules)

   at System.Data.SqlClient.SqlConnectionString..ctor(String connectionString)

   at System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)

   at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)

   at System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)

   at System.Data.SqlClient.SqlConnection.set_ConnectionString(String value)

   at FluentData.DbContext.get_CreateCommand()

   at FluentData.DbContext.Sql(String sql, Object[] parameters)