gpt4 book ai didi

sql-server - postgres_fdw 错误无法连接服务器

转载 作者:行者123 更新时间:2023-11-29 12:37:43 25 4
gpt4 key购买 nike

我写了这个 PostgreSQL 代码行,但是我有以下错误:

ERROR: could not connect to server "server\sqlexpress"

SQL state: 08001

我做错了什么?

我的代码:

在 Windows 8.1 上使用 PostgreSQL 9.3,在同一窗口上使用 MS SQL Express 2012

  CREATE EXTENSION posgres_fdw;
Query returned successfully with no result in 11 ms.

CREATE SERVER "server\SQLExpress" FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (host 'localhost', dbname 'andesmar');
Query returned successfully with no result in 12 ms.

CREATE USER MAPPING FOR public SERVER "server\sqlexpress"
OPTIONS (user 'sa', password '1234');
Query returned successfully with no result in 12 ms.

CREATE FOREIGN TABLE datosplataforma (
id bigint NOT NULL,
messagedate date NOT NULL,
receiveddate date NOT NULL,
latitude real,
longitude real,
GPSspeed real,
bearingangle integer,
odometer integer,
eventtypeid integer,
vehicleid integer,
alertid integer
)
SERVER "server\sqlexpress";
Query returned successfully with no result in 12 ms.

select * from datosplataforma;
ERROR: could not connect to server "server\sqlexpress"
SQL state: 08001

最佳答案

postgres_fdw 连接到另一个 PostgreSQL 服务器,而不是 MS SQL Server。

如果要连接到 MS SQL,则需要使用带有 MS SQL ODBC 或 JDBC 驱动程序的 ODBC 或 JDBC FDW,或者使用专用的 MS SQL FDW。

参见:http://wiki.postgresql.org/wiki/Foreign_data_wrappers

关于sql-server - postgres_fdw 错误无法连接服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23505796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com