Dowemo
0 0 0 0

1. Oracle encoding.

Query the character set of the oracle server end:

SQL> select userenv('language') from dual

My database character set query results are as follows: simplified chinese_china. Zhs16gbk.
Note: the character set may be different, so you must first query before configuration.

2. Python read data library.

Os [ 'nls_lang '] is set to consistent with the oracle database character set.

import cx_Oracleimport os 
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.ZHS16GBK'db=cx_Oracle.connect('userid','password','10.10.3.1:1521/orcl') 
cr=db.cursor() 
3. Load data into dataframe.
sql='SELECT * FROM sys_users'cr.execute(sql) 
rs=cr.fetchall() 
df=pd.DataFrame(rs)



Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs