<s> '''<STR_LIT:U+0020>''' <EOL> from __future__ import absolute_import <EOL> from __future__ import with_statement <EOL> import logging <EOL> import threading <EOL> from . import os_helper <EOL> if os_helper . isJython ( ) : <EOL> from com . ziclix . python . sql import zxJDBC <EOL> else : <EOL> from . . site_packages import pypyodbc <EOL> from . import conf <EOL> threadVar = threading . local ( ) <EOL> def closeConnection_jdbc ( ) : <EOL> logger = logging . getLogger ( __name__ ) <EOL> try : <EOL> _ = threadVar . connection <EOL> except : <EOL> threadVar . connection = None <EOL> if ( threadVar . connection is not None ) and ( threadVar . connection . closed == False ) : <EOL> threadVar . connection . close ( ) <EOL> logger . info ( "<STR_LIT>" ) <EOL> threadVar . connection = None <EOL> def closeConnection_odbc ( ) : <EOL> logger = logging . getLogger ( __name__ ) <EOL> try : <EOL> _ = threadVar . connection <EOL> except : <EOL> threadVar . connection = None <EOL> if ( threadVar . connection is not None ) and ( threadVar . connection . connected ) : <EOL> threadVar . connection . close ( ) <EOL> logger . info ( "<STR_LIT>" ) <EOL> threadVar . connection = None <EOL> def openConnection_jdbc ( ) : <EOL> logger = logging . getLogger ( __name__ ) <EOL> try : <EOL> _ = threadVar . connection <EOL> except : <EOL> threadVar . connection = None <EOL> if threadVar . connection is None : <EOL> logger . info ( '<STR_LIT>' ) <EOL> threadVar . connection = zxJDBC . connect ( conf . tera_url_jdbc , conf . tera_uid_jdbc , conf . tera_pwd_jdbc , conf . tera_driver_jdbc ) <EOL> logger . info ( '<STR_LIT>' , ( threadVar . connection , ) ) <EOL> return threadVar . connection <EOL> def openConnection_odbc ( ) : <EOL> logger = logging . getLogger ( __name__ ) <EOL> try : <EOL> _ = threadVar . connection <EOL> except : <EOL> threadVar . connection = None <EOL> if threadVar . connection is None : <EOL> logger . info ( '<STR_LIT>' ) <EOL> threadVar . connection = pypyodbc . connect ( conf . tera_url_odbc ) <EOL> logger . info ( '<STR_LIT>' , ( threadVar . connection , ) ) <EOL> return threadVar . connection <EOL> if os_helper . isJython ( ) : <EOL> openConnection = openConnection_jdbc <EOL> closeConnection = closeConnection_jdbc <EOL> else : <EOL> openConnection = openConnection_odbc <EOL> closeConnection = closeConnection_odbc </s>
