Advertisement
Guest User

Untitled

a guest
Mar 21st, 2013
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. import os
  2. import time
  3. import cx_Oracle
  4.  
  5.  
  6. def do_connection():
  7.         print 'waiting to connect'
  8.         con = cx_Oracle.connect(user=user, password=pw, dsn=dsn, cclass="blah", purity=cx_Oracle.ATTR_PURITY_SELF)
  9.         cur = con.cursor()
  10.         print 'waiting to query'
  11.         cur.execute('select sysdate from dual')
  12.         print cur.fetchall()
  13.         cur.close()
  14.         con.close()
  15.         time.sleep(30)
  16.  
  17.  
  18. user = '*'
  19. pw = '*'
  20. dsn = '*'
  21. pids = []
  22. for x in range(100):
  23.         pid = os.fork()
  24.         if not pid:
  25.                 do_connection()
  26.                 os._exit()
  27.         else:
  28.                 pids.append(pid)
  29. for pid in pids:
  30.         os.wait()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement