OracleDB

DIRAC Basic Oracle Class It provides access to the basic Oracle methods in a multithread-safe mode keeping used connections in a python Queue for further reuse.

These are the coded methods:

__init__( user, passwd, tns, [maxConnsInQueue=10] )

Initializes the Queue and tries to connect to the DB server, using the _connect method. “maxConnsInQueue” defines the size of the Queue of open connections that are kept for reuse. It also defined the maximum number of open connections available from the object. maxConnsInQueue = 0 means unlimited and it is not supported.

_except( methodName, exception, errorMessage )

Helper method for exceptions: the “methodName” and the “errorMessage” are printed with ERROR level, then the “exception” is printed (with full description if it is a Oracle Exception) and S_ERROR is returned with the errorMessage and the exception.

_connect()

Attemps connection to DB and sets the _connected flag to True upon success. Returns S_OK or S_ERROR.

_query( cmd, [conn] )

Executes SQL command “cmd”. Gets a connection from the Queue (or open a new one if none is available), the used connection is back into the Queue. If a connection to the the DB is passed as second argument this connection is used and is not in the Queue. Returns S_OK with fetchall() out in Value or S_ERROR upon failure.

_getConnection()

Gets a connection from the Queue (or open a new one if none is available) Returns S_OK with connection in Value or S_ERROR the calling method is responsible for closing this connection once it is no longer needed.

class DIRAC.Core.Utilities.OracleDB.OracleDB(userName, password='', tnsEntry='', maxQueueSize=100)

Bases: object

Basic multithreaded DIRAC Oracle Client Class

__init__(userName, password='', tnsEntry='', maxQueueSize=100)

set Oracle connection parameters and try to connect

executeStoredFunctions(packageName, returnType, parameters=None, conn=False)
executeStoredProcedure(packageName, parameters, output=True, array=None, conn=False)