2. Using Java or Python, create RESTful service that provides methods for reading, updating, deleting and creating an new entry to the table.

a. Service should use JSON for data exchange

how to use jason for data exchange?anuone can help me..

the data is:

using phyton:

-Reading Data:


#!/usr/bin/python

import MySQLdb


db = MySQLdb.connect("localhost","root","","web development skill" )


cursor = db.cursor()


sql = "SELECT * FROM table \
WHERE Country > '%d'" % (Austria)

cursor.execute(sql)


db.close()

-Updating Data:

#!/usr/bin/python

import MySQLdb

db = MySQLdb.connect("localhost","root","","web development skill" )

# insert some data
sql = """ ("INSERT INTO table VALUES ('Malaysia, '7000000', 'Kuala Lumpur')")

cursor.execute(sql)

db.commit()

# save data to database
conn.commit()

db.close()


-Deleting Data:

#!/usr/bin/python

import MySQLdb


db = MySQLdb.connect("localhost","root","","web development skill" )


cursor = db.cursor()


sql = "DELETE FROM table WHERE Country > '%d'" % (Austria)


cursor.execute(sql)

db.commit()



db.close()


- Creating an new entry:

#!/usr/bin/python

import MySQLdb


db = MySQLdb.connect("localhost","root","","web development skill" )


cursor = db.cursor()


cursor.execute("DROP TABLE IF EXISTS Asia")


sql = """CREATE TABLE Asia (
Country CHAR(20) NOT NULL,
Largest City CHAR(20),
Population INT(28) )"""

cursor.execute(sql)

db.close()