From 5addfcb048a11936f5fd11b6b76576efb5966bcc Mon Sep 17 00:00:00 2001 From: rakesh kumar Date: Tue, 31 Mar 2020 12:43:10 +0530 Subject: [PATCH] connectivity program using mysqldb --- classes/{class2.py => hgtyujh.py} | 0 database/check_module.py | 5 +++++ database/delete_row.py | 5 +++++ database/mysql_connection.py | 2 +- 4 files changed, 11 insertions(+), 1 deletion(-) rename classes/{class2.py => hgtyujh.py} (100%) create mode 100644 database/check_module.py create mode 100644 database/delete_row.py diff --git a/classes/class2.py b/classes/hgtyujh.py similarity index 100% rename from classes/class2.py rename to classes/hgtyujh.py diff --git a/database/check_module.py b/database/check_module.py new file mode 100644 index 0000000..8950b89 --- /dev/null +++ b/database/check_module.py @@ -0,0 +1,5 @@ +import MySQLdb +db = MySQLdb.connect('localhost','root','','davschool') +cursor = db.cursor() +cursor.execute('insert into game values (12,"cricket")') +db.close() \ No newline at end of file diff --git a/database/delete_row.py b/database/delete_row.py new file mode 100644 index 0000000..cca6578 --- /dev/null +++ b/database/delete_row.py @@ -0,0 +1,5 @@ +import MySQLdb +db=MySQLdb.connect('localhost', 'root', '', 'davschool') +cursor=db.cursor() +cursor.execute('delete from game where gname="cricket" ') +db.close() \ No newline at end of file diff --git a/database/mysql_connection.py b/database/mysql_connection.py index 8c9edd0..c789cce 100644 --- a/database/mysql_connection.py +++ b/database/mysql_connection.py @@ -1,7 +1,7 @@ """Database connectivity mysql.""" import MySQLdb # Open database connection -db = MySQLdb.connect("localhost", "root", "", "cable" ) +db = MySQLdb.connect("localhost", "root", "", "binarynote" ) # prepare a cursor object using cursor() method cursor = db.cursor() # execute SQL query using execute() method.