Skip to content

Commit

Permalink
New option: --client-driver. Useful for applications whose end-users …
Browse files Browse the repository at this point in the history
…are not aware cx_Oracle is being used. By default, 'sql*plus'
  • Loading branch information
quentinhardy committed Mar 11, 2021
1 parent 7b8524f commit 97c3e2f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions OracleDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

import logging, random, string, cx_Oracle

'''
try:
cx_Oracle.init_oracle_client(config_dir="conf/")
cx_Oracle.init_oracle_client()
except Exception as e:
logging.error("Impossible to load local configuration files in conf/: {0}".format(str(e)))

'''

from Utils import areEquals,checkOracleVersion,getOracleConnection,ErrorSQLRequest
from progressbar import *
Expand Down
9 changes: 8 additions & 1 deletion odat.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def main():
PPconnection.add_argument('-P', dest='password', required=False, default=None, help='Oracle password')
PPconnection.add_argument('-d', dest='sid', required=False, default=None, help='Oracle System ID (SID)')
PPconnection.add_argument('-n', dest='serviceName', required=False, default=None, help='Oracle Service Name')
PPconnection.add_argument('--client-driver', dest='client-driver', required=False, default="SQL*PLUS", help='Set client driver name (default: %(default)s)')
PPconnection.add_argument('--sysdba', dest='SYSDBA', action='store_true', default=False, help='connection as SYSDBA')
PPconnection.add_argument('--sysoper', dest='SYSOPER', action='store_true', default=False, help='connection as SYSOPER')
#1.2- Parent parser: output options
Expand Down Expand Up @@ -765,7 +766,13 @@ def main():
if 'auditType' in args and (args['auditType']=='unwrapper' or args['auditType']=='clean'):
pass
else:
if ipOrNameServerHasBeenGiven(args) == False : return EXIT_MISS_ARGUMENT
if ipOrNameServerHasBeenGiven(args) == False :
return EXIT_MISS_ARGUMENT
try:
cx_Oracle.init_oracle_client(config_dir="conf/", driver_name=args['client-driver'], error_url= "")
logging.info("CX_Oracle is well configured according to parameters")
except Exception as e:
logging.error("Impossible to load local configuration files in conf/ and to set driver_name: {0}".format(str(e)))
logging.debug("cx_Oracle Version: {0}".format(cx_Oracle.version))
logging.debug("Oracle Client Version: {0}".format(cx_Oracle.clientversion()))
arguments.func(args)
Expand Down

0 comments on commit 97c3e2f

Please sign in to comment.