Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ballerina/mysql;
- import ballerina/log;
- //Create mysql client
- mysql:Client testDB = new({
- host: "localhost",
- port: 3306,
- name : "GOVSBAL",
- username: "demouser",
- password: "password@123"
- });
- public function main(string... args) {
- //Create table
- var ret = testDB->update("CREATE TABLE employee (id INT NOT NULL AUTO_INCREMENT,
- name VARCHAR(1024), age INT, PRIMARY KEY (ID))");
- if (ret is error) {
- log:printError("Error occured", err = ret);
- }
- //Stop the mysql client
- testDB.stop();
- }
Add Comment
Please, Sign In to add comment