무회blog

DB: 200526-pyDB-001.002, DB연동 및 데이터 불러오기 본문

Python

DB: 200526-pyDB-001.002, DB연동 및 데이터 불러오기

최무회 2020. 5. 25. 17:56

conda install -c anaconda cx_oracle

import cx_Oracle
import time 
import pandas as pd 
import os

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

os.putenv('NLS_LANG','KOREAN_KOREA.KO16MSWIN949')  # 한글 처리 ? 
con01 = cx_Oracle.connect("scott/tiger@192.168.182.1:1521/xe")
df_emp01 = pd.read_sql("select * from emp", con=con01)

professor = pd.read_sql("select * from emp",con=con01)
# professor
professor.head()
professor.dtypes

####################################################
# cur = con01.cursor()
# cur.execute("select*from emp")

# for row in cur:
#     print(row)
# cur.close()
# con.close()
####################################################
# print(type(df_emp01))
# print(df_emp01)

 

Comments