행위

"Python 오라클 연결 cx oracle"의 두 판 사이의 차이

DB CAFE

1번째 줄: 1번째 줄:
 
== 개요 ==
 
== 개요 ==
 
https://oracle.github.io/python-cx_Oracle/samples/tutorial/resources/cx_Oracle_arch.png
 
https://oracle.github.io/python-cx_Oracle/samples/tutorial/resources/cx_Oracle_arch.png
 
+
----
 
== 접속 모듈 설치 ==
 
== 접속 모듈 설치 ==
 
<source lang=python>
 
<source lang=python>
 
pip install cx_Oracle
 
pip install cx_Oracle
 
</source>
 
</source>
 +
----
 
=== 사용자 매뉴얼 ===
 
=== 사용자 매뉴얼 ===
 
https://cx-oracle.readthedocs.io/en/latest/user_guide/sql_execution.html#fetch-methods
 
https://cx-oracle.readthedocs.io/en/latest/user_guide/sql_execution.html#fetch-methods
32번째 줄: 33번째 줄:
 
   print("테스트 이름 리스트 : ", name)
 
   print("테스트 이름 리스트 : ", name)
 
</source>
 
</source>
 +
 
[[Category:python]]
 
[[Category:python]]

2023년 5월 31일 (수) 14:56 판

thumb_up 추천메뉴 바로가기


1 개요[편집]

cx_Oracle_arch.png


2 접속 모듈 설치[편집]

pip install cx_Oracle

2.2 접속 테스트[편집]

import cx_Oracle

#한글 지원 방법
import os
os.putenv('NLS_LANG', '.UTF8')

#연결에 필요한 기본 정보 (유저, 비밀번호, 데이터베이스 서버 주소)
connection = cx_Oracle.connect('Id','password','localhost/orcl')

cursor = connection.cursor()

cursor.execute("""
   select name
   from test_db
   where text = :texting""",
   texting = "테스트"
)

for name in cursor:
   print("테스트 이름 리스트 : ", name)