Esempio n. 1
0
def save_to_mysql(num_list):
    conn = MYSQLdb.connect(host='', user='', passwd='', port='')
    cur = conn.cursor()

    sql_create_database = 'create database if not EXISTS  activecode_db'
    cur.execute(sql_create_database)

    conn.select_db('activecode_db')
    sql_create_table = 'create table if not exists active_codes(active_code CHAR(32) )'
    cur.execute(sql_create_table)

    cur.executemany('insert into actice_code VALUE(%s) ', num_list)

    conn.commit()
    cur.close()
    conn.close()
Esempio n. 2
0
import MYSQLdb

db = MYSQLdb.connect("localhost","root","lunatics@92","smartlab")
cur = db.cursor()
if cur != null:
    print('Sucessfull')
else:
    print('!sucessfull')
Esempio n. 3
0
import MYSQLdb

db = MYSQLdb.connect("localhost", "testuser", "test123", "TESTDB")

cursor = db.cursor()

cursor.execute("SELECT VERSION()")

data = cursor.fetchone()
print "Database version: %s " % data

db.close()

Esempio n. 4
0
#!/usr/bin/env python
import MYSQLdb

con = MYSQLdb.connect('10.10.104.13', 3306, 'root', '@RSadmin123', 'htc-testbed')
con.close()
Esempio n. 5
0
def storeInDB():
	con = MYSQLdb.connect("localhost","root","password","virtualDB")
Esempio n. 6
0
def encryptThem():
	con = MYSQLdb.connect("localhost","root","password","virtualDB")
Esempio n. 7
0
#! /usr/lib/python
import MYSQLdb
import cgi

db= MYSQLdb.connect(host ="localhost" ,
                   user="******",
                  passwd="manpreet",
                  dbname="MYdatabase")

cur=db.cursor()

cur.execute("SELECT VERSION()")
vv=cur.fetchone()

#for row in cur.fetchall():
#       print row[0]
#db.close()"""

print "content-Type:text/html"
print "database version is: %s" %vv

db.close();
                                                              1,1           Top