Robotframework reading MySQL and Oracle databases

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.