Npgsql throws an error: wrong connection string. Can't connect to postgreSQL [F#]
Npgsql throws an error: wrong connection string. Can't connect to postgreSQL [F#]
我在 F# 中使用 SQLProvider 连接到我的(本地)PostgreSQL 数据库。
我从 fsprojects:
开始使用这段代码
open FSharp.Data.Sql
open Npgsql
let [<Literal>] ResolutionPath =
__SOURCE_DIRECTORY__ + @"/../../packages/Npgsql/lib/net451/"
[<Literal>]
let connectionString = "Host=localhost;Port=5432;User ID=test;Password=test;Database=testdb;"
type PostgreSQL =
SqlDataProvider<
Common.DatabaseProviderTypes.POSTGRESQL,
ConnectionString = connectionString,
ResolutionPath = ResolutionPath,
IndividualsAmount = 1000,
UseOptionTypes = true>
当我试图编译它时,我收到了这条错误消息:
(path)/Database.fs(60,9): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not create the connection, most likely this means that the connectionString is wrong. See error from Npgsql to troubleshoot: The type initializer for 'Npgsql.Counters' threw an exception.
(path)/Database.fs(60,9): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not create the connection, most likely this means that the connectionString is wrong. See error from Npgsql to troubleshoot: The type initializer for 'Npgsql.Counters' threw an exception.
我已经检查过用户 ID 和密码以及连接字符串中的所有内容都是正确的。
我实际上不知道如何调试这个问题。
你知道什么地方出了问题吗?
它对您有用吗?没有任何问题吗?
我使用的是 macOS 10.12。
最后,如果我无法解决这个问题,您是否可以推荐任何其他连接到 postgreSQL 的方法(使用类型提供程序)?
我在 F# 中使用 SQLProvider 连接到我的(本地)PostgreSQL 数据库。 我从 fsprojects:
开始使用这段代码open FSharp.Data.Sql
open Npgsql
let [<Literal>] ResolutionPath =
__SOURCE_DIRECTORY__ + @"/../../packages/Npgsql/lib/net451/"
[<Literal>]
let connectionString = "Host=localhost;Port=5432;User ID=test;Password=test;Database=testdb;"
type PostgreSQL =
SqlDataProvider<
Common.DatabaseProviderTypes.POSTGRESQL,
ConnectionString = connectionString,
ResolutionPath = ResolutionPath,
IndividualsAmount = 1000,
UseOptionTypes = true>
当我试图编译它时,我收到了这条错误消息:
(path)/Database.fs(60,9): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not create the connection, most likely this means that the connectionString is wrong. See error from Npgsql to troubleshoot: The type initializer for 'Npgsql.Counters' threw an exception. (path)/Database.fs(60,9): error FS3033: The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Could not create the connection, most likely this means that the connectionString is wrong. See error from Npgsql to troubleshoot: The type initializer for 'Npgsql.Counters' threw an exception.
我已经检查过用户 ID 和密码以及连接字符串中的所有内容都是正确的。 我实际上不知道如何调试这个问题。 你知道什么地方出了问题吗? 它对您有用吗?没有任何问题吗?
我使用的是 macOS 10.12。
最后,如果我无法解决这个问题,您是否可以推荐任何其他连接到 postgreSQL 的方法(使用类型提供程序)?