Using Database Connections
Many readers, writers, and transformers require you to connect and authenticate to database services in order to use them. For example, to use the Oracle Spatial Relational reader, you need to provide a service name, username, and password. Database connections provide a convenient and secure way to store and reuse these connection parameters. Each time you need to use the same connection in a workspace, you can use the saved connection, rather than re-entering the connection parameters. If the connection parameters change, you can edit them in one place, rather than in each workspace that uses the connection.
When you use a database connection in a workspace, the Navigator displays only the connection name. The service name, username, password, and other connection parameters do not display. For example, here is how connection information displays in the parameters of a reader that uses a database connection.
Additionally, all database connections in the workspace are listed under Database Connections.
Managing Database Connections
Database connections are managed under FME Options: Database Connections (Tools > FME Options > Database Connections). Using these tools, you can edit connection parameters, change connection visibility, and remove connections. It is usually more convenient to add a database connection at the time you are using one in a workspace. However, you can also add a connection in Database Connections, and use it later in a workspace.
Adding a Database Connection in a Workspace
You can add a database connection, or use an existing one, at the time you want to use one in an Add Reader, Add Writer, or Transformer Parameters dialog.
For example, when adding a PostgreSQL reader, in the drop-down menu of the Dataset field, select Add Database Connection. (For file-based datasets, you must first choose Select Database Connection from the drop-down, then select Add Database Connection from the Connection drop-down in the Select Database Connection dialog.)
In the Add Database Connection dialog, specify the connection parameters, and the give the connection a name (or accept the default), and click Save.
Visibility: This field applies only if Connection Storage, as specified in Tools > FME Options > Default Paths, is a shared location visible to multiple users. Specify whether the connection is available only to yourself, or to any user of the database (Public). For more information, click Help from the Default Paths window under Tools > FME Options.
Note: The following characters are not allowed in connection names: ^ \ / : * ? " < > | & = ' + % #
Alternatively, if you do not want to add or use an existing connection, in the drop-down menu of the Dataset field, select Embed Connection Parameters. Then, click Parameters and specify the connection parameters in the parameters dialog.
For more information, see the applicable topic in the FME Readers and Writers or FME Transformers Help.
Reusing a Database Connection
After you create a connection, it is available for you to reuse along with any others you have created that apply to the format or service:
Note: If you did not create a connection, it may not be available for you to use unless its visibility is updated. For more information, see To change the visibility of a database connection.
Changing an Embedded Connection to a Saved Connection in a Workspace
You can change a connection from one whose parameters are embedded in the workspace to a database connection with saved parameters.
- If the object that is using the connection is a reader or writer, right click on the reader or writer in the Navigator, and select Use Database Connection.
- If the object that is using the connection is a transformer, in the Transformer Parameters dialog, open the drop-down menu of the dataset connection.
- To use an existing connection, select the connection name.
- To create one and use it right away, select Add Database Connection.
You can switch from using a database connection with saved parameters to embedding the connection parameters in the workspace.
- If the object using the database connection is a reader or writer, right click on the reader or writer in the Navigator, and select Embed Connection Parameters.
- If the object using the database connection is a transformer:
- In the Transformer Parameters dialog, open the drop-down menu of the dataset connection, and select Embed Connection Parameters.
- Click the Parameters button. In the database parameters dialog, specify the connection parameters and click OK.
- In the transformer parameters dialog, click OK.
For more information, see the applicable topic in the FME Transformers Help.