Guest User

Untitled

a guest
Dec 19th, 2018
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import ballerina/mysql;
  2. import ballerina/log;
  3.  
  4. //Create mysql client
  5. mysql:Client testDB = new({
  6. host: "localhost",
  7. port: 3306,
  8. name : "GOVSBAL",
  9. username: "demouser",
  10. password: "password@123"
  11. });
  12.  
  13. public function main(string... args) {
  14. //Create table
  15. var ret = testDB->update("CREATE TABLE employee (id INT NOT NULL AUTO_INCREMENT,
  16. name VARCHAR(1024), age INT, PRIMARY KEY (ID))");
  17. if (ret is error) {
  18. log:printError("Error occured", err = ret);
  19. }
  20. //Stop the mysql client
  21. testDB.stop();
  22. }
Add Comment
Please, Sign In to add comment