Guest User

Untitled

a guest
May 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. CREATE DATABASE IF NOT EXISTS `network` /*!40100 DEFAULT CHARACTER SET latin1 */;
  2. USE `network`;
  3.  
  4. import pyodbc
  5. def connectToDB():
  6. connection = None
  7.  
  8. while connection is None:
  9. try:
  10. connection = pyodbc.connect('DSN=data')
  11.  
  12. except:
  13. print ("n[DB connector] Error connecting to database. Trying again in 1 sec.")
  14.  
  15.  
  16. time.sleep(1)
  17.  
  18. return connection
Add Comment
Please, Sign In to add comment