Created
September 29, 2013 08:23
-
-
Save aguegu/6750398 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import os | |
import cx_Oracle | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.AL32UTF8' | |
conn = cx_Oracle.connect('username/password@address:port/database') | |
cursor = conn.cursor() | |
cursor.execute('SELECT T.NICKNAME FROM T_SM_USER T WHERE T.ID = 1') | |
row = cursor.fetchall() | |
print "%r" % row[0][0] | |
print row[0][0].decode("utf-8") | |
conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment