Python connect Oracle Database

Hi everyone, today i will show you how to connect Oracle database using python.

Python is very popular and easy to learn programing language. We may need to connect to the database when programming with python. Let’s think simple, just you need import Oracle db package .

import cx_Oracle

Thats all. If you can’t import you need to dowload first. Open ide terminal and

pip install cx_Oracle

Create python file (.py) and add this rows,

conn = cx_Oracle.connect('world/oracle@192.168.43.73/TESTDB')
cursor=conn.cursor()
print (conn.version)

A small code to check that we are connected to the database

 

Thats all, good luck and see you next article.

Deniz Parlak

Hi, I'm a Computer Engineering student in Dumlupınar University.I will graduate next year. I did an internship TurkNet Telecominication Company in 2018 June- 2018 September. I had experience Linux/Unix system, SQL Server Management , SSRS, Mysql Database Management,Troubleshooting performance issues in Linux. I also interested Oracle database and technologies. I want to work as Oracle DBA after my University. I am practicing Unix, Exadata, Orace Cloud, Oracle RAC, Dataguard, EBS, Oracle BI and etc and i hope the articles will be helpful. Any questions, or support please write email deniz.parlak@yahoo.com

Leave a Reply

Your email address will not be published. Required fields are marked *