connect.py
500 Bytes
import cx_Oracle
import os
from config.key import DATABASE_ID, DATABASE_PW
from config.URLs import DATABASE_URL
os.putenv('NLS_LANG', '.UTF8')
def connectDB():
connection = cx_Oracle.connect(DATABASE_ID, DATABASE_PW, DATABASE_URL)
cursor = connection.cursor()
# cursor.execute("""
# select name
# from test_db
# where text = :texting""",
# texting="테스트"
# )
return cursor
def closeDB(cursor):
cursor.close()