Object-relational database management system (ORDBMS) are software, which stores the data in a permanent manner
Object-relational database management system allows performing the ‘random read’ and ‘ random write’ operations on the data of the ORDBMS
ORDBMS provides the security for the data
Online transaction processing (OLTP) operations implementations purpose we have to use ORDBMS
Difference ORDBMS are
To provides the communication between the python program to the corresponding ORDBMS, we use databases related external modules. Databases related external modules we can install by using
Download & install the oracle database 11g or 12c Enterprise edition
Service name (0r) logical database name (0r) SID or host storing name=oracle
IP address=local host
Download & install ‘python 2.7 version”
Microsoft visual c++ compiler for python 2.7 version” download and install
Download & Install the “cx_oracle” module by using following command
Search in command prompt
c:/>cd python 2.7
c:/python 2.7 > cd scripts
c:/python 2.7/scripts>PIP install cx_oracle
We can establish connection with the database by calling connect function of cx_oracle module
con=cx_oracle.connect (‘dbusername’, ‘dbpwd’,ipadd of the computer where database is installed: portno/ database service name’)
Connect function establish the connection with database with the given details, store the connection details into connection object and that object address will be stored into the given variable.
After establishing the connection with database to sent the sql queries to the database we have to create “cursor object”
Cursor objects can be created by calling cursor method of the connection object
By calling method of cursor objects, we can execute the sql queries or psql programs
By calling the methods of cursor objects we can read the data from the cursor object which is given by the database (sql) queries or psql programs
After reading the data from the cursor object we have to close the cursor object by calling close method of cursor object.
After closing the cursor object we have to close the connection object by calling close method of connection object.
Whenever connection is established with the database connection should get closed before terminating the program.
To close the connection if the connection is established we use exception handling techniques.
Free Demo for Corporate & Online Trainings.