我编写了这个PostgreSQL代码行,但是我遇到了以下错误:
错误:无法连接到服务器" server \ sqlexpress"
SQL状态:08001
我做错了什么?
我的代码:
在Windows 8.1和MS SQL Express 2012上在同一窗口上使用PostgreSQL 9.3
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
答案 0 :(得分:4)
postgres_fdw
连接到另一个PostgreSQL服务器,而不是MS SQL Server。
如果要连接到MS SQL,则需要将ODBC或JDBC FDW与MS SQL ODBC或JDBC驱动程序一起使用,或者使用专用的MS SQL FDW。