Connect Excel to PostgreSQL via ODBC

I am trying to connect to a PostgreSQL database table from Excel through a 32-bit PostgreSQL ODBC driver.

In Excel, I go to Data> Get Data> From Other Sources> From ODBC. I go to the ODBC data source that I installed, enter the credentials, and it clearly connects with the appearance of the available tables. The preview failed, and the request failed when I clicked Download, indicating an error:

DataSource.Error: ODBC: ERROR [HY000] Error while executing the query
Details:
    DataSourceKind=Odbc
    DataSourcePath=dsn=PostgreSQL
    OdbcErrors=Table

Error message image

When I test the connection in the ODBC admin, it succeeds. I tried both ANSI and Unicode drivers. TIBCO Spotfire connects to an ODBC data source and simply retrieves the data.

Any help you can provide would be greatly appreciated.

+4
1

, , psqlODBC, psqlodbc_09_06_0500 , . PostgreSQL. :

ERROR:  syntax error at or near "ta" at character 553
STATEMENT:  select ta.attname, ia.attnum, ic.relname, n.nspname, tc.relname from pg_catalog.pg_attribute ta, pg_catalog.pg_attribute ia, pg_catalog.pg_class tc, pg_catalog.pg_index i, pg_catalog.pg_namespace n, pg_catalog.pg_class ic where tc.relname = 'rates' AND n.nspname = 'public' AND tc.oid = i.indrelid AND n.oid = tc.relnamespace AND i.indisprimary = 't' AND ia.attrelid = i.indexrelid AND ta.attrelid = i.indrelid AND ta.attnum = i.indkey[ia.attnum-1] AND (NOT ta.attisdropped) AND (NOT ia.attisdropped) AND ic.oid = i.indexrelid order by ia.attnumselect ta.attname, ia.attnum, ic.relname, n.nspname, NULL from pg_catalog.pg_attribute ta, pg_catalog.pg_attribute ia, pg_catalog.pg_class ic, pg_catalog.pg_index i, pg_catalog.pg_namespace n where ic.relname = 'rates_pkey' AND n.nspname = 'public' ANDic.oid = i.indexrelid AND n.oid = ic.relnamespace AND ia.attrelid = i.indexrelid AND ta.attrelid = i.indrelid AND ta.attnum = i.indkey[ia.attnum-1] AND (NOT ta.attisdropped) AND (NOT ia.attisdropped) order by ia.attnum

553: order by ia.attnumselect ta.attname, ia.attnum. , .

psqlodbc_09_06_0200, . 32- Office, psqlodbc_09_06_0200-x86.zip https://www.postgresql.org/ftp/odbc/versions/msi/. ( x64, 64- Office.)

, psqlodbc_09_06_0200-x86.zip psqlodbc_09_06_0500-x86.zip, - .

+1

Source: https://habr.com/ru/post/1693787/


All Articles