Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
161 views
in Technique[技术] by (71.8m points)

sql server - Cannot connect Polybase to PostgreSQL

Trying to setup a connection to a PostgresSQL server with MSSQL Polybase. Today we use Linked Server to withdraw data from the Postgresdatabases into MSSQL and it works fine. But there is some functionality with Polybase that would solve some program issus regarding joining etc, and therefore Polybase is the solution. As long it works! ;-)

But I dont get it to work. And I can't find any real help with Google.

This is the code;

> CREATE DATABASE SCOPED CREDENTIAL PG_EXAMPLE WITH IDENTITY = 'pgUSER', Secret = 'verylongpassword';

> CREATE EXTERNAL DATA SOURCE PG_EXAMPLE_DATA
 >WITH ( LOCATION = 'odbc://PG_SERVERNAME:5432',
 >CONNECTION_OPTIONS = 'Driver={PostgreSQL Unicode(x64)}',
 >PUSHDOWN = ON,
 >CREDENTIAL = PG_EXAMPLE);

Trying to create a external table:

 >    CREATE EXTERNAL TABLE databas(
 >    namn [nvarchar](255) NULL,
 >    datorid [nvarchar](255) NULL
 >    ) WITH (
 >    LOCATION='exampel_databas_on_PGserver',
 >    DATA_SOURCE=PG_EXAMPLE_DATA
 >    );

ERROR MESSAGE

>    Msg 105082, Level 16, State 1, Line 10
>    105082;Generic ODBC error: Error while executing the query .

Can anybody spread some light here, what I'm doing wrong. Somebody perhaps tried and got it to work??

Any help and suggestion is very mutch appreciated.

Thanks!!!

question from:https://stackoverflow.com/questions/65904854/cannot-connect-polybase-to-postgresql

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Check that LOCATION is the name of the table, it may be case sensitive, and you can't specify the database neither the schema. Try connecting with the "postgres" user if you can. Also try specifying the IP instead of the hostname. I've used the ANSI driver, try with it as well: {PostgreSQL ANSI(x64)}. As a last resource, check the driver version, I tested with psqlodbc_12_02_0000-x64.zip.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...