docs/versioned_docs/version-2.61.0/data-sources/mariadb.md
ToolJet can connect to both self-hosted and cloud-based MariaDB servers to read and write data.
To establish a connection with the MariaDB global datasource, you can either click on the +Add new global datasource button located on the query panel or navigate to the Global Datasources page through the ToolJet dashboard.
ToolJet requires the following connection details to connect to MariaDB:
:::info Click on Test connection button to verify if the credentials are correct and that the database is accessible to ToolJet server. Click on Save button to save the data source. :::
Once you have connected to the MariaDB datasource, follow these steps to write queries and interact with a MariaDB database from the ToolJet application:
+Add button to open the list of available local and global datasources.:::tip Query results can be transformed using Transformation. For more information on transformations, please refer to our documentation at link. :::
<div style={{textAlign: 'center'}}> </div>Suppose there exists a MariaDB database named "customers." We can create an example table called "users" with the following columns:
id (integer, auto-increment)name (varchar)age (integer)email (varchar)The above command will create the "users" table within the "customers" database. Now, let's explore the CRUD commands for this table in MariaDB:
CREATE TABLE user(
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
age INT,
email VARCHAR(100)
);
Here are the CRUD commands for this table in MariaDB:
INSERT INTO user (name, age, email)
VALUES ('John Doe', 25, '[email protected]');
INSERT INTO user (name, age, email)
VALUES
('John Doe', 25, '[email protected]'),
('Jane Smith', 30, '[email protected]'),
('Bob Johnson', 35, '[email protected]');
SELECT * FROM user;
SELECT name, age, email FROM user;
SELECT name, age, email
FROM user
WHERE age > 25;
UPDATE user
SET age = 26
WHERE id = 1;
DELETE FROM user WHERE id = 1;
Remember to adjust the values and conditions based on your specific needs. These commands will allow you to create the table, insert data, retrieve data, update data, and delete data in the "users" table in MariaDB.
If you are having trouble connecting a MariaDB data source to ToolJet, try the following:
If you are still having trouble, please contact ToolJet support or ask on slack for assistance.