SQL tasks in Microservices Engine (MSE) XXL-JOB need database connection details to run queries. Create a data source to store these details before you create SQL tasks.
MSE XXL-JOB supports MySQL and PostgreSQL data sources.
Prerequisites
Before you begin, make sure that you have:
An MSE XXL-JOB instance
The endpoint, port, and credentials for your MySQL or PostgreSQL database
Network connectivity between the MSE XXL-JOB instance and the database
Create a data source
Log in to the MSE XXL-JOB console.
In the top navigation bar, select a region.
In the left-side navigation pane, choose Task Scheduling > XXL-JOB Edition.
Click the target instance.
In the left-side navigation pane, click Data Source.
Click Create DataSource.
Configure the following parameters.
Parameter
Description
Example
Data Source Type
Database type. Valid values: MySQL, PostgreSQL.
MySQL
Data Source Name
Unique name within the same data source type.
myDatasource
Description
Brief description of the data source.
Test data source
Endpoint
Database server address. Supports IP addresses and domain names.
rm-bp1119psx9f628j1i.mysql.rds.aliyuncs.com
Port
Port number for the database connection.
3306
Username
Database login username.
root
Password
Database password. Stored in encrypted form.
<your-password>Database Name
Name of the target database.
test_db
Advanced Parameters
Advanced connection parameters in JSON format.
{"useUnicode":"true","useSSL":"false","characterEncoding":"utf-8"}Click the test connection button to verify that MSE XXL-JOB can connect to the database, and then save the data source.
Note: If the connection test fails, verify the endpoint, port, credentials, and network connectivity between the MSE XXL-JOB instance and the database.
Modify a data source
In the left-side navigation pane, click Data Source.
Find the target data source and edit the parameters.
Test the connection and save your changes.
Note: When you test the connection during modification, the system uses the original password. If you enter a new password, the system uses the new password for the test instead.
What to do next
After you create a data source, create SQL tasks to run queries against the connected database. For more information, see SQL task management.