odbc_fdw
odbc_fdw : Foreign data wrapper for accessing remote databases using ODBC
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 8520 | odbc_fdw
|
odbc_fdw
|
0.5.1 |
FDW
|
PostgreSQL
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r
|
No
|
Yes
|
No
|
Yes
|
yes
|
no
|
| Relationships | |
|---|---|
| See Also | wrappers
multicorn
jdbc_fdw
mysql_fdw
oracle_fdw
tds_fdw
db2_fdw
postgres_fdw
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG
|
0.5.1 |
18
17
16
15
14
|
odbc_fdw |
- |
| RPM | PGDG
|
0.5.1 |
18
17
16
15
14
|
odbc_fdw_$v |
unixODBC |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
MISS
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
el8.aarch64
|
MISS
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
el9.x86_64
|
MISS
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
el9.aarch64
|
MISS
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
el10.x86_64
|
MISS
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
el10.aarch64
|
MISS
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
PGDG 0.5.1
|
d12.x86_64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
d12.aarch64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
d13.x86_64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
d13.aarch64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
u22.x86_64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
u22.aarch64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
u24.x86_64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
u24.aarch64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
odbc_fdw_17 |
0.5.1 |
el8.x86_64 | pgdg | 26.4 KiB | odbc_fdw_17-0.5.1-2PGDG.rhel8.x86_64.rpm |
odbc_fdw_17 |
0.5.1 |
el8.aarch64 | pgdg | 25.6 KiB | odbc_fdw_17-0.5.1-2PGDG.rhel8.aarch64.rpm |
odbc_fdw_17 |
0.5.1 |
el9.x86_64 | pgdg | 26.4 KiB | odbc_fdw_17-0.5.1-2PGDG.rhel9.x86_64.rpm |
odbc_fdw_17 |
0.5.1 |
el9.aarch64 | pgdg | 25.9 KiB | odbc_fdw_17-0.5.1-2PGDG.rhel9.aarch64.rpm |
odbc_fdw_17 |
0.5.1 |
el10.x86_64 | pgdg | 27.4 KiB | odbc_fdw_17-0.5.1-3PGDG.rhel10.x86_64.rpm |
odbc_fdw_17 |
0.5.1 |
el10.aarch64 | pgdg | 26.5 KiB | odbc_fdw_17-0.5.1-3PGDG.rhel10.aarch64.rpm |
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
odbc_fdw_16 |
0.5.1 |
el8.x86_64 | pgdg | 26.3 KiB | odbc_fdw_16-0.5.1-1PGDG.rhel8.x86_64.rpm |
odbc_fdw_16 |
0.5.1 |
el8.aarch64 | pgdg | 25.5 KiB | odbc_fdw_16-0.5.1-1PGDG.rhel8.aarch64.rpm |
odbc_fdw_16 |
0.5.1 |
el9.x86_64 | pgdg | 26.3 KiB | odbc_fdw_16-0.5.1-1PGDG.rhel9.x86_64.rpm |
odbc_fdw_16 |
0.5.1 |
el9.aarch64 | pgdg | 25.8 KiB | odbc_fdw_16-0.5.1-1PGDG.rhel9.aarch64.rpm |
odbc_fdw_16 |
0.5.1 |
el10.x86_64 | pgdg | 27.4 KiB | odbc_fdw_16-0.5.1-3PGDG.rhel10.x86_64.rpm |
odbc_fdw_16 |
0.5.1 |
el10.aarch64 | pgdg | 26.5 KiB | odbc_fdw_16-0.5.1-3PGDG.rhel10.aarch64.rpm |
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
odbc_fdw_15 |
0.5.1 |
el8.x86_64 | pgdg | 26.3 KiB | odbc_fdw_15-0.5.1-1PGDG.rhel8.x86_64.rpm |
odbc_fdw_15 |
0.5.1 |
el8.aarch64 | pgdg | 25.5 KiB | odbc_fdw_15-0.5.1-1PGDG.rhel8.aarch64.rpm |
odbc_fdw_15 |
0.5.1 |
el9.x86_64 | pgdg | 26.3 KiB | odbc_fdw_15-0.5.1-1PGDG.rhel9.x86_64.rpm |
odbc_fdw_15 |
0.5.1 |
el9.aarch64 | pgdg | 25.7 KiB | odbc_fdw_15-0.5.1-1PGDG.rhel9.aarch64.rpm |
odbc_fdw_15 |
0.5.1 |
el10.x86_64 | pgdg | 27.4 KiB | odbc_fdw_15-0.5.1-3PGDG.rhel10.x86_64.rpm |
odbc_fdw_15 |
0.5.1 |
el10.aarch64 | pgdg | 26.5 KiB | odbc_fdw_15-0.5.1-3PGDG.rhel10.aarch64.rpm |
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
odbc_fdw_14 |
0.5.1 |
el8.x86_64 | pgdg | 26.3 KiB | odbc_fdw_14-0.5.1-1PGDG.rhel8.x86_64.rpm |
odbc_fdw_14 |
0.5.1 |
el8.aarch64 | pgdg | 25.5 KiB | odbc_fdw_14-0.5.1-1PGDG.rhel8.aarch64.rpm |
odbc_fdw_14 |
0.5.1 |
el9.x86_64 | pgdg | 26.3 KiB | odbc_fdw_14-0.5.1-1PGDG.rhel9.x86_64.rpm |
odbc_fdw_14 |
0.5.1 |
el9.aarch64 | pgdg | 25.8 KiB | odbc_fdw_14-0.5.1-1PGDG.rhel9.aarch64.rpm |
odbc_fdw_14 |
0.5.1 |
el10.x86_64 | pgdg | 27.4 KiB | odbc_fdw_14-0.5.1-3PGDG.rhel10.x86_64.rpm |
odbc_fdw_14 |
0.5.1 |
el10.aarch64 | pgdg | 26.5 KiB | odbc_fdw_14-0.5.1-3PGDG.rhel10.aarch64.rpm |
Source
Install
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install odbc_fdw; # install via package name, for the active PG version
pig install odbc_fdw -v 17; # install for PG 17
pig install odbc_fdw -v 16; # install for PG 16
pig install odbc_fdw -v 15; # install for PG 15
pig install odbc_fdw -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION odbc_fdw;Usage
odbc_fdw: Foreign data wrapper for accessing remote databases using ODBC
Create Server
Connect using a DSN defined in your ODBC configuration:
CREATE EXTENSION odbc_fdw;
CREATE SERVER odbc_server
FOREIGN DATA WRAPPER odbc_fdw
OPTIONS (dsn 'test');Or specify connection attributes directly without a DSN:
CREATE SERVER odbc_server
FOREIGN DATA WRAPPER odbc_fdw
OPTIONS (
odbc_DRIVER 'MySQL',
odbc_SERVER '192.168.1.17',
encoding 'iso88591'
);Server Options: dsn (ODBC data source name), driver (ODBC driver name, required if no DSN), odbc_* (driver-specific attributes), encoding (remote database character encoding).
Prefix driver-specific options with odbc_. Attributes DSN, DRIVER, UID, and PWD are automatically uppercased.
Create User Mapping
CREATE USER MAPPING FOR postgres
SERVER odbc_server
OPTIONS (odbc_UID 'root', odbc_PWD '');Create Foreign Table
CREATE FOREIGN TABLE odbc_table (
id integer,
name varchar(255),
description text,
users float4,
created timestamp
)
SERVER odbc_server
OPTIONS (
odbc_DATABASE 'mydb',
schema 'test',
sql_query 'SELECT id, name, description, created, users FROM test.mytable',
sql_count 'SELECT count(id) FROM test.mytable'
);
SELECT * FROM odbc_table;Table Options: schema (remote schema), table (remote table name), sql_query (custom SQL query, overrides table), sql_count (custom count SQL).
Import Foreign Schema
IMPORT FOREIGN SCHEMA test
FROM SERVER odbc_server
INTO public
OPTIONS (odbc_DATABASE 'mydb');