In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "Python how to connect oracle database", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Python how to connect oracle database" bar!
Oracle is the most powerful database, and python also provides sufficient support. However, slightly different from other databases, the concept of oracle's database is completely different from that of mysql, etc., so the operation on using oracle is also very different.
Download instant client
Tip: you need an oracle account to download ow!
Extract to a location and configure environment variables
II. Cmd loading package
Write to load cx_Oracle package in cmd
Pip install cx_Oracle
3. Python connects to the oracle database import cx_Oracle as cxcon = cx.connect ('user name', 'password', '127.0.0.1 import cx_Oracle as cxcon 1521 Unix orcl')\ 127.0.0.1: change the database domain name 1521 to the connection database port number orcl to the connected database\ 4. Oracle database data extraction call
Next, the data is extracted and called:
Import cx_Oracle as cx # Import module con = cx.connect ('root',' root123' Cursor = con.cursor () # create a cursor cursor.execute ("select * from ORCL where ID='28'") # execute the sql statement data = cursor.fetchone () # get a data print (data) # print data cursor.close () # close the cursor con.close () # close the database connection thank you for reading The above is the content of "how to connect Python to oracle database". After the study of this article, I believe you have a deeper understanding of how Python connects to oracle database, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.