Modified the solutions of the HoL for Collaborate (#170)
added db_config and made changes to solutions to use db_config values
This commit is contained in:
parent
bae5cbe76a
commit
6fd56a5d41
|
@ -10,8 +10,9 @@ from __future__ import print_function
|
|||
|
||||
import cx_Oracle
|
||||
import decimal
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
cur = con.cursor()
|
||||
|
||||
BOOK_TYPE_NAME = "UDT_BOOK"
|
||||
|
|
|
@ -10,8 +10,9 @@ from __future__ import print_function
|
|||
|
||||
import cx_Oracle
|
||||
import decimal
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
cur = con.cursor()
|
||||
|
||||
BOOK_TYPE_NAME = "UDT_BOOK"
|
||||
|
|
|
@ -10,8 +10,9 @@ from __future__ import print_function
|
|||
|
||||
import cx_Oracle
|
||||
import decimal
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
cur = con.cursor()
|
||||
|
||||
BOOK_TYPE_NAME = "UDT_BOOK"
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import cx_Oracle
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
cur = con.cursor()
|
||||
|
||||
rows = [ (1, "First" ), (2, "Second" ),
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import cx_Oracle
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
cur = con.cursor()
|
||||
|
||||
# Create table
|
||||
|
|
|
@ -11,8 +11,9 @@ from __future__ import print_function
|
|||
import cx_Oracle
|
||||
import threading
|
||||
import time
|
||||
import db_config
|
||||
|
||||
pool = cx_Oracle.SessionPool("pythonhol", "welcome", "localhost/orclpdb:pooled",
|
||||
pool = cx_Oracle.SessionPool(db_config.user, db_config.pw, db_config.dsn + ":pooled",
|
||||
min = 2, max = 5, increment = 1, threaded = True)
|
||||
|
||||
def Query():
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
import os
|
||||
|
||||
dirName = os.path.dirname(os.path.dirname(__file__))
|
||||
exec(open(os.path.join(dirName, "db_config.py"), "r").read())
|
|
@ -9,8 +9,9 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import cx_Oracle
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
|
||||
cur = con.cursor()
|
||||
cur.execute("select * from dept order by deptno")
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import cx_Oracle
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
|
||||
cur = con.cursor()
|
||||
cur.execute("select * from dept order by deptno")
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import cx_Oracle
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
cur = con.cursor()
|
||||
|
||||
cur.execute("select * from dept order by deptno")
|
||||
|
|
|
@ -10,8 +10,9 @@ from __future__ import print_function
|
|||
|
||||
import collections
|
||||
import cx_Oracle
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
|
||||
cur = con.cursor()
|
||||
|
||||
|
|
|
@ -9,12 +9,13 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import cx_Oracle
|
||||
import db_config
|
||||
|
||||
class MyConnection(cx_Oracle.Connection):
|
||||
|
||||
def __init__(self):
|
||||
print("Connecting to database")
|
||||
return super(MyConnection, self).__init__("pythonhol", "welcome", "localhost/orclpdb")
|
||||
return super(MyConnection, self).__init__(db_config.user, db_config.pw, db_config.dsn)
|
||||
|
||||
def cursor(self):
|
||||
return MyCursor(self)
|
||||
|
|
|
@ -10,8 +10,9 @@ from __future__ import print_function
|
|||
|
||||
import cx_Oracle
|
||||
import decimal
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
cur = con.cursor()
|
||||
|
||||
def ReturnNumbersAsDecimal(cursor, name, defaultType, size, precision, scale):
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import cx_Oracle
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
|
||||
cur = con.cursor()
|
||||
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import cx_Oracle
|
||||
import db_config
|
||||
|
||||
con = cx_Oracle.connect("pythonhol", "welcome", "localhost/orclpdb")
|
||||
con = cx_Oracle.connect(db_config.user, db_config.pw, db_config.dsn)
|
||||
|
||||
print(cx_Oracle.version)
|
||||
print("Database version:", con.version)
|
||||
|
|
Loading…
Reference in New Issue