Create-Database-Object
Command Description
Create Database Object
Command Prototype
objDatabase = Database.CreateDB(dbtype,dbDict)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
dbtype | True | enum | "MySQL" | The database type |
dbDict | True | multiDictionary | {"host": "", "port": "3306", "user": "","password": "","database": "","charset": "utf8"} | Connect to the config dictionary of a database |
return
objDatabase,The variable used to save the output of the command.
Demo
TracePrint("----------------------------Create database object------------------- ---------")
/*
Input 1:
dbtype--the type of database
dbDict-- the configuration dictionary for connecting to the database
Outgoing parameters:
objDatabase--results after running
Command prototype: objDatabase = Database.CreateDB(dbtype,dbDict)
*/
objDatabase = Database.CreateDB("MySQL", {
"host": ip,
"port": port,
"user": username,
"password": password,
"database": db,
"charset": "utf8"
})