INTERFACE PYTHON WITH MYSQL
1 What do you mean by Database connectivity?
Ans Database connectivity refers to connection/communication between front-end
applications like Python, Java etc. to Back-end Applications like MySQL, SQL Server etc.
2 What is Result set?
Ans Result set refers the logical set records fetched from the database by executing a query.
3 Name of connector/driver used to establish bridge between Python and MySQL?
Ans mysql.connector
4 In the following connection string: Identify the elements : (assume ‘admin’ is password)
connect(__<<1>> = “localhost”,__<<2>> =‟ root‟, <<3>>=”admin”)
Ans <<1>> = host, <<2>> = user, <<3> = passwd
5 Which function of connection is used to check whether connection to mysql is
successfully done or not?
Ans con.is_connected() where con is name of connection object.
6 Which of the component/object which act as a container to hold all the data returned
from the query and from there we can fetch data one at a time?
Ans Cursor
7 Which command of Python is used to install mysql.connector driver in python IDLE?
Ans pip install mysql.connector
8 Which command is used to add database connection package in the Python program?
Ans import mysql.connector
9 Identify the correct statement to create cursor:
import mysql.connector as msq
con = msq.connect( #Connection String ) # Assuming all parameter required as passed
mycursor =
a. con.cursor()
b. con.create_cursor()
c. con.open_cursor()
d. con.get_cursor()
Ans a. con.cursor()
10 Which function is used to clean connection environment and close connection?
Ans con.close() where con is the name of connection object.