Skip to main content

ALTER FOREIGN SERVER (SQL)

Alters a foreign server definition.

Synopsis

Change Connection

ALTER [ FOREIGN ] SERVER server-name 
  ALTER CONNECTION jdbc-connection

ALTER [ FOREIGN ] SERVER server-name 
  ALTER HOST file-path
Change Delimited Identifiers

ALTER [ FOREIGN ] SERVER server-name ALTER id-option
Change Connection and Delimited Identifiers

ALTER [ FOREIGN ] SERVER server-name 
  MODIFY [ CONNECTION jdbc-connection | HOST file-path ],
  id-option

Arguments

Arguments Description
server-name The name for the foreign server definition being altered. A valid identifier.
CONNECTION cxn-name The name of the new JDBC connection that will connect InterSystems IRIS with an external data source. A valid identifier. Must be the name of a JDBC connection that has already been defined. Must be delimited.
HOST file-path The new file path that you want to use to access files that will be projected into InterSystems IRIS.
id-option Either DELIMITEDIDS or NODELIMITEDIDS. Sets behavior based on whether the external data source accepts delimited identifiers or not.

Description

The ALTER FOREIGN SERVER command allows you to change how a foreign server connects with an external data source. You may use the ALTER variant of the command to change a single parameter or the MODIFY variant to change multiple parameters. In particular, you may change the file path, JDBC connection, or delimited identifier option that the foreign server uses when connecting with an external source.

Before you change the connection parameters of a foreign server with either the CONNECTION or HOST property, you should be sure that your changes will not affect your ability to access the foreign tables you have defined on the foreign server. For example, if you change the HOST file path and still want to access the tables you have already defined, you should move any .csv files associated with foreign tables into the new file path. You will be unable to access data in these tables until you have made the proper changes. There are no concerns when you use ALTER FOREIGN SERVER to change these connection parameters on a foreign server that does not have a foreign table defined on it.

Examples

The following example alters a foreign server’s file path to read data from a different directory.

ALTER FOREIGN SERVER Sample.Test ALTER HOST '/second/filepath'

The following example alters a foreign server’s JDBC connection to read data from a different database source and indicates that the external data source permits delimited identifiers.

ALTER FOREIGN SERVER Sample.Test MODIFY CONNECTION 'anotherConnection', DELIMITEDIDS

See Also

FeedbackOpens in a new tab