Advanced Database & Application Migration (ADAM) SQL Adapter is a forward proxy service developed based on the PostgreSQL communication protocol. This topic describes how to use SQL Adapter to convert incompatible SQL statements.
Description
SQL Adapter is provided to convert incompatible SQL statements that are migrated from Oracle databases to PolarDB for Oracle or PolarDB for PostgreSQL clusters. You can use SQL Adapter in the following scenarios:
- Convert incompatible SQL statements that are migrated from Oracle databases to PolarDB for Oracle or PolarDB for PostgreSQL clusters in real time.
- Asynchronously record all incompatible SQL statements during data migration.
- Modify SQL statements that cannot be automatically converted.
Prerequisites
- The Migrate schemas operation is complete.
- Your application is deployed in a virtual private cloud (VPC). SQL Adapter is unavailable over the Internet.
- The AliyunAdamAccessingDatabaseRole role is enabled.
Procedure
- Apply for the permissions to use ADAM SQL Adapter.
- Log on to the Data Management (DMS) console V5.0.
- In the top navigation bar, move the pointer over DTS. Choose .
- In the ADAM SQL Adapter section, click Apply.
- On the page that appears, specify parameters such as Company Name, Phone Number, and Application Purpose. Then, click Submit.
- Create an adapter.
- Configure the destination database.
- Obtain the IP address and port number of the adapter.
- Log on to the Data Management (DMS) console V5.0.
- In the top navigation bar, move the pointer over DTS. Choose .
- In the ADAM SQL Adapter section, click Details.
- On the ADAM Adapter page, view the IP address and port number of the adapter.
- Modify the URL of the database to which your application is connected.
jdbc:polardb://172.18.100.6:8888/polardb_test
Parameter Example Description URL Prefix jdbc:polardb://
The prefix of the URL. All URLs of PolarDB databases are prefixed with jdbc:polardb://
.IP Address 172.18.100.6
The IP address of the adapter. For more information about how to obtain the IP address, see the "Obtain the IP address and port number of the adapter" section of this topic. Port Number 8888
The port number of the adapter. For more information about how to obtain the port number, see the "Obtain the IP address and port number of the adapter" section of this topic. Database Name polardb_test
The name of the database to which your application is connected. Note You do not need to modify the database account or password. - View the SQL compatibility of the adapter and the information about SQL statement conversion.
- On the ADAM Adapter page, find the adapter and click Details in the Actions column.
- View the SQL compatibility of the adapter and the information about SQL statement conversion.
- Configure custom rules for SQL statement conversion. For SQL statements with which ADAM SQL Adapter is not compatible, click Create Rule in the upper-left corner.
Parameter Description Rule Type The type of the custom SQL conversion rule. Valid values:- Text Replacement
- Regular Expression Replacement
Note If you select Regular Expression Replacement, you must use regular expressions with caution. Malicious regular expressions may exhaust the resources of the adapter. ADAM SQL Adapter does not ensure high availability.Text to Match The text or regular expression to be replaced. Text After Replacement The text or regular expression after replacement. Effective Scope The scope to which the rule applies. Valid values:- All SQL Statements
- Specified SQL Statements
Incompatible SQL Statements The specified SQL statements to which the rule applies. This parameter is displayed only when you set Effective Scope to Specified SQL Statements. Specify SQL statements to which the rule applies.