# encoding: utf-8 # 版权所有 2024 涂聚文有限公司 # 许可信息查看:言語成了邀功盡責的功臣,還需要行爲每日來值班嗎 # 描述:python -m pip install oracledb # python -m pip install cx_Oracle --upgrade # pip install cx_Oracle # Author : geovindu,Geovin Du 涂聚文. # IDE : PyCharm 2024.3 python 3.11 # os : windows 10 # database : mysql 9.0 sql server 2019, poostgreSQL 17.0 # Datetime : 2024/12/21 22:14 # User : geovindu # Product : PyCharm # Project : Pysimple # File : oracledemo.py # explain : 学习 import getpass import oracledb import cx_Oracle # 连接到Oracle数据库 connection = cx_Oracle.connect(user="SCOTT", password="88888", dsn="localhost/ORCL") # 创建游标 cursor = connection.cursor() # 执行查询 cursor.execute("SELECT * FROM DEPT") # 获取查询结果 result = cursor.fetchall() # 打印查询结果 for row in result: print(row)
标签:11g,Database,python,cursor,cx,install,Oracle,import From: https://www.cnblogs.com/geovindu/p/18621487