Description: python3 version of Oh! !
Installation pymysql
Pip Walsall pymysql
Quick Start
pymysql Import # Step 1: Connect to the database con = pymysql.connect (host = "test.lemonban.com ", # address database user = 'xxxxx', account # to log database password = "xxxxx", # Login password for the database port = 3306, # port database = 'xxxxx', # library name ) # step 2: create a cursor CUR = con.cursor () # the third step: the implementation of the corresponding sql statement method: the execute () sql = 'the FROM the SELECT * Students.;' cur.execute (SQL)
2、oracle
python in the butt oracle database, use third-party libraries for cx_Oracle
installation
pip install cx_Oracle
Quick Start
cx_Oracle Import # first piece connects to the database parameter 'username / password / @ ip: port / library name' CON = cx_Oracle.connect ( 'the User / password @ Host / Databases') # Step create a cursor cur = con.cursor () # third step executed sql statement sql = 'the FROM the SELECT * Students.;' cur.execute (sql)