Exemple #1
0
    def start(cls, query, **options):
        ConStr = "SERVER=informix;DATABASE=test;HOST=127.0.0.1;SERVICE=60000;UID=informix;PWD=changeme;"
        try:
            print options["server"]
            conn = dbapi2.connect(str(options["server"]), str(''), str(''),
                                  str(''), str(''))
        except Exception as e:
            print('ERROR: Connect failed')
            print(e)
            quit()

        return Query(StatementClient(conn, query, **options))
def connect_to_stats03_informixdb():
    global stats03IfxDbConn, stats03IfxDbCur
    try:
        print('Establishing connection with Stats03 Informix Database..')
        stats03IfxDbConn = ifxDb.connect(
            properties.get('db.stats03.connection.string'), "", "")
        print('Successfully Connected with Stats03 Informix Database !!')
    except Exception as e:
        print(e)
        print('Connection failed with Stats03 Informix Database!!')
        release_dadt_informix_db_connections()
        print('Exiting..')
        email_execution_status_as_failure()
        sys.exit()
    # Create Cursor
    print('Creating cursor for Stats03 Informix Database..')
    stats03IfxDbCur = stats03IfxDbConn.cursor()
def connect_to_dadt_informixdb():
    global dadtIfxDbConn, dadtIfxDbCur
    # Establish Database connection with Informix Database.
    try:
        print('Establishing connection with dadt Informix Database..')
        dadtIfxDbConn = ifxDb.connect(
            properties.get('db.dadt.connection.string'), "", "")
        print('Successfully Connected with dadt Informix Database !!')
    except Exception as e:
        print(e)
        print('Connection failed with dadt Informix Database!!')
        print('Exiting..')
        email_execution_status_as_failure()
        sys.exit()
    # Create Cursor
    print('Creating cursor for dadt Informix Database..')
    dadtIfxDbCur = dadtIfxDbConn.cursor()
Exemple #4
0
def connect_to_stats03_informixdb():
    global stats03IfxDbConn, stats03IfxDbCur
    print(
        'Going to create Database connection with Stats03 Informix with Connection "SERVER=stats03;DB_LOCALE=en_US.57372;DATABASE=stats03;HOST=dhscbincdbs01al.asp.dhisco.com;SERVICE=40000;UID=adsstats;PWD=RVXUF7J?8-zV;')
    # Informix Database Connection String
    ConStr = "SERVER=stats03;DB_LOCALE=en_US.57372;DATABASE=stats03;HOST=dhscbincdbs01al.asp.dhisco.com;SERVICE=40000;UID=adsstats;PWD=RVXUF7J?8-zV;"
    # Establish Database connection with Informix Database.
    try:
        print('Establishing connection with Stats03 Informix Database..')
        stats03IfxDbConn = ifxDb.connect(ConStr, "", "")
        print('Successfully Connected with Stats03 Informix Database !!')
    except Exception as e:
        print(e)
        print('Connection failed with Stats03 Informix Database!!')
        print('Exiting..')
        sys.exit()
    # Create Cursor
    print('Creating cursor for Stats03 Informix Database..')
    stats03IfxDbCur = stats03IfxDbConn.cursor()
Exemple #5
0
def connect_to_dadt_informixdb():
    global dadtIfxDbConn, dadtIfxDbCur
    print(
        'Going to create Database connection with dadt Informix with Connection String SERVER=udqa;DB_LOCALE=en_US.57372;DATABASE=dadt;HOST=dhscalqaldbm01a.asp.dhisco.com;SERVICE=40013;UID=web;PWD=5kywalk3r;')
    # Informix Database Connection String
    ConStr = "SERVER=udqa;DB_LOCALE=en_US.57372;DATABASE=dadt;HOST=dhscalqaldbm01a.asp.dhisco.com;SERVICE=40013;UID=web;PWD=5kywalk3r;"
    # Establish Database connection with Informix Database.
    try:
        print('Establishing connection with dadt Informix Database..')
        dadtIfxDbConn = ifxDb.connect(ConStr, "", "")
        print('Successfully Connected with dadt Informix Database !!')
    except Exception as e:
        print(e)
        print('Connection failed with dadt Informix Database!!')
        print('Exiting..')
        sys.exit()
    # Create Cursor
    print('Creating cursor for dadt Informix Database..')
    dadtIfxDbCur = dadtIfxDbConn.cursor()
Exemple #6
0
def Main(x, y):
    print(' ')
    print("Speed Test: \'Pure Python\' vs \'Native Code\'. ")
    print('Calculating Prime Numbers Between {:d} and {:d}'.format(x, y))

    print(' ')
    print('Executing C  function, please wait....')
    s = datetime.datetime.now()
    rc3_c = IfxPy.SpeedTestWithCPrimeCount(x, y)
    e = datetime.datetime.now()
    delta_c = e - s

    print('Number of Primes count is {}'.format(rc3_c))

    print('Executing Py function, please wait....')
    rc3 = 0
    s = datetime.datetime.now()

    rc3 = dbapi2.SpeedTestWithPyPrimeCount(x, y)

    # Try enhancing Python function to improve the result,
    # then you may use 'MySpeedTestWithPyPrimeCount()'
    # rc3 = MySpeedTestWithPyPrimeCount( x, y)

    e = datetime.datetime.now()
    delta_py = e - s

    if rc3 == rc3_c:
        print(' ')
        print('Time taken by :')
        print('     Native function = {};'.format(delta_c))
        print('     Python function = {};'.format(delta_py))
        print(' ')
        r = delta_py / delta_c
        print(
            "The Native C function appeared to be {0:.2f} times faster".format(
                r))
    else:
        print("Error: Prime Count not matching C={} Py={}".format(rc3_c, rc3))

    print(' ')
Exemple #7
0
import IfxPyDbi

ConStr = "SERVER=infor99;DATABASE=db0;HOST=127.0.0.1;SERVICE=27988;UID=informix;PWD=980120;"

try:
    # netstat -a | findstr  9088
    conn = IfxPyDbi.connect(ConStr, "", "")
except Exception as e:
    print('ERROR: Connect failed')
    print(e)
    quit()
import IfxPyDbi as ifxDb
import mysql.connector as mariadb
from datetime import date

print(
    'Going to create Informix Database connection with Connection String SERVER=udqa;DB_LOCALE=en_US.57372;DATABASE=dadt;HOST=dhscalqaldbm01a.asp.dhisco.com;SERVICE=40013;UID=web;PWD=5kywalk3r;'
)
# Informix Database Connection String
ConStr = "SERVER=udqa;DB_LOCALE=en_US.57372;DATABASE=dadt;HOST=dhscalqaldbm01a.asp.dhisco.com;SERVICE=40013;UID=web;PWD=5kywalk3r;"

# Establish Database connection with Informix Database.
try:
    print('Establishing conncetion with Informix DB.')
    dadtIfxDbConn = ifxDb.connect(ConStr, "", "")
    print('Connection Successfully established with InformixDb!!')
except Exception as e:
    print(e)
    print('INformix Db Connection failed!!')

print('Creating cursor.')
dadtIfxDbCur = dadtIfxDbConn.cursor()

# Establish Database connection with Mariadb Database.
try:
    print('Establishing conncetion with Maria DB.')
    mariadb_connection = mariadb.connect(user='******',
                                         password='******',
                                         database='test')
    print('Connection Successfully established with MariaDb!!')
except Exception as e:
    print(e)
import IfxPyDbi as dbapi2
from datetime import date

print(
    'Going to create Informix Database connection with Connection String SERVER=udqa;DB_LOCALE=en_US.57372;DATABASE=dadt;HOST=dhscalqaldbm01a.asp.dhisco.com;SERVICE=40013;UID=web;PWD=5kywalk3r;')
# Informix Database Connection String
ConStr = "SERVER=udqa;DB_LOCALE=en_US.57372;DATABASE=dadt;HOST=dhscalqaldbm01a.asp.dhisco.com;SERVICE=40013;UID=web;PWD=5kywalk3r;"

# Establish Database connection with Informix Database.
try:
    print('Going to Connect to Informix DB.')
    conn = dbapi2.connect(ConStr, "", "")
    print('Connected Successfully!!')
except Exception as e:
    print(e)
    print('Connection failed!!')
    conn.close()

# Create Cursor
print('Creating cursor.')
cur = conn.cursor()

# Prepare Query type 3
query = "select a.chain as chain, \
         a.config_level as config_level , \
         a.affiliates as affiliates , \
         a.properties as properties ,\
         a.cache_keys as cache_keys , \
         a.noncache_keys as noncache_keys, \
         a.cache_neg_rates as cache_neg_rates , \
         a.force_cache_only as force_cache_only ,\