Refreshing the relational map
- Last Updated: May 12, 2021
- 2 minute read
- DataDirect Connectors
- JDBC
- MongoDB 6.1
- Documentation
When new native objects are added to your database, the driver must refresh the schema map to
discover and map these objects to the relational view. You can refresh the schema map using
the following methods:
- At Connection: When the RefreshSchema connection property is set to
true, the driver refreshes the map each time it connects to your data source. - Configuration Manager: In the Configuration
Manager, you can refresh your schema map by clicking the Test
Connect, entering the
REFRESH MAPstatement in the Test Query field, then clicking Execute. Note that you must provide your connection information in the appropriate fields to successfully test connect. For more information on testing connections with the Configuration Manager, see "Testing connections and queries." - Refresh Map SQL Extension: Your application can refresh the schema map by executing the Refresh Map statement. For details and syntax, see "REFRESH MAP (EXT)."
- Command-line (Interactive SQL script): You
can refresh the schema map from a command-line using the Interactive SQL tool that is
embedded in your driver .jar file. For the
Interactive SQL method, we recommend writing a simple script to invoke the tool to refresh
the schema map. You can execute a script using the following
command:
See the following section for information on creating an Interactive SQL script.java -jar mongodb.jar --isql <path>/<script_name>.isql
Using an Interactive SQL script to refresh the relational map
An Interactive SQL script is a simple text file that uses the file_name.isql naming convention. The file is comprised of the connection properties used to make your connection, plus a set of required commands. For properties with sensitive values, such as passwords, you can use environment and system variables, or specify that the tool prompts the user for those values. See the following example for examples of the supported syntax.
Note: The driver uses the
schema map specified by the SchemaMap property to obtain the values for connection
properties stored in the file. If you don't specify a value for SchemaMap, you will need
to manually specify these connection properties in the script file. Note that any values
specified in the script file will override those in the SchemaMap file.
Sample Interactive SQL Script
# You can set connection property values one at a time, using variables,
# literal values, or prompts.
# Takes SchemaMap value from the system property,
# for example: -Dexample.refresh_map.schemamap=<path>
SCHEMAMAP=${example.refresh_map.schemamap}
# Takes the user value from the environment varaiable.
USER=${env.refresh_map.user}
# Prompts the user for ask for the password value when running the script.
PASSWORD?
# The following are required commands
CONNECT
REFRESH MAP;
EXIT