当前位置: 首页>>代码示例>>Python>>正文


Python cx_Oracle.SYSDBA属性代码示例

本文整理汇总了Python中cx_Oracle.SYSDBA属性的典型用法代码示例。如果您正苦于以下问题:Python cx_Oracle.SYSDBA属性的具体用法?Python cx_Oracle.SYSDBA怎么用?Python cx_Oracle.SYSDBA使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在cx_Oracle的用法示例。


在下文中一共展示了cx_Oracle.SYSDBA属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_conn_mode

# 需要导入模块: import cx_Oracle [as 别名]
# 或者: from cx_Oracle import SYSDBA [as 别名]
def test_get_conn_mode(self, mock_connect):
        mode = {
            'sysdba': cx_Oracle.SYSDBA,
            'sysasm': cx_Oracle.SYSASM,
            'sysoper': cx_Oracle.SYSOPER,
            'sysbkp': cx_Oracle.SYSBKP,
            'sysdgd': cx_Oracle.SYSDGD,
            'syskmt': cx_Oracle.SYSKMT,
        }
        first = True
        for mod in mode:
            self.connection.extra = json.dumps({'mode': mod})
            self.db_hook.get_conn()
            if first:
                assert mock_connect.call_count == 1
                first = False
            args, kwargs = mock_connect.call_args
            self.assertEqual(args, ())
            self.assertEqual(kwargs['mode'], mode.get(mod)) 
开发者ID:apache,项目名称:airflow,代码行数:21,代码来源:test_oracle.py

示例2: connect

# 需要导入模块: import cx_Oracle [as 别名]
# 或者: from cx_Oracle import SYSDBA [as 别名]
def connect(self):
        self.initConnection()
        self.__dsn = cx_Oracle.makedsn(self.hostname, self.port, self.db)
        self.__dsn = utf8encode(self.__dsn)
        self.user = utf8encode(self.user)
        self.password = utf8encode(self.password)

        try:
            self.connector = cx_Oracle.connect(dsn=self.__dsn, user=self.user, password=self.password, mode=cx_Oracle.SYSDBA)
            logger.info("successfully connected as SYSDBA")
        except (cx_Oracle.OperationalError, cx_Oracle.DatabaseError, cx_Oracle.InterfaceError), ex:
            if "Oracle Client library" in str(ex):
                msg = re.sub(r"DPI-\d+:\s+", "", str(ex))
                msg = re.sub(r': ("[^"]+")', r" (\g<1>)", msg)
                msg = re.sub(r". See (http[^ ]+)", r'. See "\g<1>"', msg)
                raise SqlmapConnectionException(msg)

            try:
                self.connector = cx_Oracle.connect(dsn=self.__dsn, user=self.user, password=self.password)
            except (cx_Oracle.OperationalError, cx_Oracle.DatabaseError, cx_Oracle.InterfaceError), msg:
                raise SqlmapConnectionException(msg) 
开发者ID:sabri-zaki,项目名称:EasY_HaCk,代码行数:23,代码来源:connector.py

示例3: db_connect

# 需要导入模块: import cx_Oracle [as 别名]
# 或者: from cx_Oracle import SYSDBA [as 别名]
def db_connect(args):
    if args.type == "mysql" or args.type == "mariadb":
        import mysql.connector
        try:
            connection = mysql.connector.connect(
                user=args.user,
                password=args.password,
                database=args.db)
        except mysql.connector.Error as err:
            print(colorize("red", "[ERROR] {}".format(err)))
            return None
    elif args.type == "mssql":
        import pymssql
        try:
            connection = pymssql.connect(server="localhost", database=args.db)
        except pymssql.Error as err:
            print(colorize("red", "[ERROR] {}".format(err)))
            return None
    elif args.type == "pgsql":
        import psycopg2
        try:
            connection = psycopg2.connect(
                "dbname='{}' user='{}' password='{}'".format(
                    args.db, args.user, args.password))
        except psycopg2.Error as err:
            print(colorize("red", "[ERROR] {}".format(err)))
            return None
    elif args.type == "oracle":
        import cx_Oracle
        try:
            connection = cx_Oracle.connect(
                args.user, args.password, cx_Oracle.makedsn(
                    '127.0.0.1', 1521, args.db), mode=cx_Oracle.SYSDBA)
        except cx_Oracle.Error as err:
            print(colorize("red", "[ERROR] {}".format(err)))
            return None

    return connection 
开发者ID:migolovanov,项目名称:libinjection-fuzzer,代码行数:40,代码来源:fuzzer.py

示例4: connect

# 需要导入模块: import cx_Oracle [as 别名]
# 或者: from cx_Oracle import SYSDBA [as 别名]
def connect(self):
        self.initConnection()
        self.__dsn = cx_Oracle.makedsn(self.hostname, self.port, self.db)
        self.__dsn = utf8encode(self.__dsn)
        self.user = utf8encode(self.user)
        self.password = utf8encode(self.password)

        try:
            self.connector = cx_Oracle.connect(dsn=self.__dsn, user=self.user, password=self.password, mode=cx_Oracle.SYSDBA)
            logger.info("successfully connected as SYSDBA")
        except (cx_Oracle.OperationalError, cx_Oracle.DatabaseError, cx_Oracle.InterfaceError):
            try:
                self.connector = cx_Oracle.connect(dsn=self.__dsn, user=self.user, password=self.password)
            except (cx_Oracle.OperationalError, cx_Oracle.DatabaseError, cx_Oracle.InterfaceError), msg:
                raise SqlmapConnectionException(msg) 
开发者ID:krintoxi,项目名称:NoobSec-Toolkit,代码行数:17,代码来源:connector.py

示例5: test_mode

# 需要导入模块: import cx_Oracle [as 别名]
# 或者: from cx_Oracle import SYSDBA [as 别名]
def test_mode(self):
        import cx_Oracle

        self._test_db_opt(
            "oracle+cx_oracle://scott:tiger@host/?mode=sYsDBA",
            "mode",
            cx_Oracle.SYSDBA,
        )

        self._test_db_opt(
            "oracle+cx_oracle://scott:tiger@host/?mode=SYSOPER",
            "mode",
            cx_Oracle.SYSOPER,
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:16,代码来源:test_dialect.py


注:本文中的cx_Oracle.SYSDBA属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。