How Do I View the List in the Database Specified by Catalog?
Catalog is an external data directory. The following describes how to connect the JDBC Catalog to other data sources through the standard JDBC protocol.
Syntax
CREATE CATALOG [IF NOT EXISTS] catalog_name PROPERTIES ("key"="value", ...);
Parameter |
Mandatory |
Default Value |
Description |
---|---|---|---|
user |
Yes |
- |
Username of the corresponding database. |
password |
Yes |
- |
Password of the database. |
jdbc_url |
Yes |
- |
JDBC URL. |
driver_url |
Yes |
- |
Name of the JDBC Driver JAR package. |
driver_class |
Yes |
- |
Name of the JDBC driver class. |
lower_case_table_names |
No |
"false" |
Whether to synchronize the database name and table name of the JDBC external data source in lowercase. |
only_specified_database |
No |
"false" |
Whether to synchronize only the specified database. |
include_database_list |
No |
"" |
This parameter is used to synchronize certain databases when only_specified_database is set to true. Use commas (,) to separate databases. The database name is case sensitive. |
exclude_database_list |
No |
"" |
This parameter is used to not synchronize certain databases when only_specified_database is set to true. Use commas (,) to separate databases. The database name is case sensitive. |

- driver_url can be set to:
- File name, for example, mysql-connector-java-5.1.47.jar. Place the JAR package in the jdbc_drivers/ directory under the FE and BE deployment directories in advance and the system can locate the file.
- Local absolute path, for example, file:///path/to/mysql-connector-java-5.1.47.jar. Place the JAR package in the specified paths of all FE and BE nodes in advance.
- HTTP address, for example, https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/jdbc_driver/mysql-connector-java-5.1.47.jar. The system downloads the driver file from the HTTP address. This only supports HTTP services with no authentication requirements.
- only_specified_database: You can specify the database or schema to be connected during JDBC connection. For example, you can specify a database in jdbc_url of MySQL and currentSchema in jdbc_url of PostgreSQL.
- include_database_list: This parameter is used to synchronize certain databases when only_specified_database is set to true. Use commas (,) to separate databases. The database names are case sensitive.
- exclude_database_list: This parameter is used to not synchronize certain databases when only_specified_database is set to true. Use commas (,) to separate databases. The database names are case sensitive.
- When include_database_list and exclude_database_list specify overlapping databases, exclude_database_list would take effect with higher privilege over include_database_list.
If you need to connect to the Oracle database when using these parameters, use the version of the JAR package no less than 8 (such as jdbc8.jar).
Procedure
- Create a catalog.
CREATE CATALOG jdbc_mysql PROPERTIES ( "type"="jdbc", "user"="root", "password"="******", "jdbc_url" = "JDBC URL", "driver_url" = "mysql-connector-java-8.0.25.jar", "driver_class" = "com.mysql.cj.jdbc.Driver" );
- View the Catalog.
show catalogs;
Figure 1 Viewing the Catalog - Run the switch Catalog name command to switch to the created catalog.
Figure 2 Switching to the created catalog
- View the mapped database.
show databases;
Figure 3 Viewing the mapped database - Use the database.
use Database name;
Figure 4 Using the database - Check the database table.
show tables;
Figure 5 Checking the database table
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot