One, robotframework connection MySQL Database
1, install Databaselibrary, pymysql
Execute with cmd command: Pip install Robotframework-databaselibrary
cmd command execution: Pip install Pymysql
2, import databaselibrary package to Robotframework
3. Use keywords to operate the database
Connecting databases: Connect to database using custom params
This keyword needs to pass in 2 parameters, Pymysql, and database connection information (host= ' database IP ', port= ' database Port ', user= ' database login user name ', passwd= ' password ', db= ' database name (not table name) ')
Execute Query statement:
Execute Delete and change statement: Execute SQL String
Disconnecting a database: Disconnect from
Note: Do not use semicolons at the end of the SQL statement, use the Disconnect database connection to end each time you connect to the database
Second, robotframework connect Oracle database connection
1, install databaselibrary (see connection MySQL database operation)
2, install cx_oracle,databaselibrary, enter cx_oracle download page, download python corresponding version number: http://sourceforge.net/projects/cx-oracle/files/
After download, install directly, after installation, in your \python27\lib\site-packages directory, you can see the Database Library folder and Cx_oracle.pyd files;
3. Copy the OCI file of the local connection Oracle database to the Site-packages directory
4. Use keywords for Oracle database operations
Connect to Database Using the Custom Params of Connect to, need to pass in 2 parameters, cx_oracle and database connection information-' account ', ' Password ', ' IP: Port/ORCL
Query and modify the same keyword as the mysql operation;
Robotframework reading MySQL and Oracle databases