TDS Foreign data wrapper
- Author: Geoff Montee
- Name: tds_fdw
- File: tds_fdw/ForeignServerCreation.md
Creating a Foreign Server
Foreign server parameters accepted:
The servername, address or hostname of the foreign server server.
This can be a DSN, as specified in freetds.conf. See FreeTDS name lookup.
The port of the foreign server. This is optional. Instead of providing a port here, it can be specified in freetds.conf (if servername is a DSN).
The database to connect to for this server.
This option tells tds_fdw to connect directly to database if dbuse is 0. If dbuse is not 0, tds_fdw will connect to the server's default database, and then select database by calling DB-Library's dbuse() function.
For Azure, dbuse currently needs to be set to 0.
The language to use for messages and the locale to use for date formats. FreeTDS may default to us_english on most systems. You can probably also change this in freetds.conf.
For information related to this for MS SQL Server, see SET LANGUAGE in MS SQL Server.
For information related to Sybase ASE, see Sybase ASE login options and SET LANGUAGE in Sybase ASE.
The client character set to use for the connection, if you need to set this for some reason.
For TDS protocol versions 7.0+, the connection always uses UCS-2, so this parameter does nothing in those cases. See Localization and TDS 7.0.
The version of the TDS protocol to use for this server. See Choosing a TDS protocol version and History of TDS Versions.
The function used for the TDS message handler. Options are "notice" and "blackhole." With the "notice" option, TDS messages are turned into PostgreSQL notices. With the "blackhole" option, TDS messages are ignored.
A cost that is used to represent the overhead of using this FDW used in query planning.
A cost that is used to represent the overhead of fetching rows from this server used in query planning.
Foreign table parameters accepted in server definition:
Some foreign table options can also be set at the server level. Those include:
CREATE SERVER mssql_svr FOREIGN DATA WRAPPER tds_fdw OPTIONS (servername '127.0.0.1', port '1433', database 'tds_fdw_test', tds_version '7.1');