Skip to main content

Create-Database-Object

Command Description

Create Database Object

Command Prototype

objDatabase = Database.CreateDB(dbtype,dbDict)

Parameter Description

ParameterRequiredTypeDefaultDescription
dbtypeTrueenum"MySQL"The database type
dbDictTruemultiDictionary{"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"
})