Question

i need help with this python assignment asking for creating a simple database (client application そ归乔 Assignment rh ENCS-393-2174-WW: Tset5.pdf A2.pdf textbook.pdf Department of ComputV ← → O仚 file:///C 18/comp%20348/A2.pdf 5. Print Report: This will print the contents of the database, sorted by name. Note that the sorted contents should be sent by the server back to the client and then displayed by the client app. The Print Report function is r because it is the primary way for the grader (and you) to determine fthe database server is working correctly. Specifically you can display the database before you perform any updates, then check it again later to make sure everything is worklng. You can NOT get a passing grade on the assignment if the Print Rep。rt option does not work! So the report might look like this: thon DB content3 John 34 ABC 8treet 768-3245 Bob 26 123 Doop Road 345-5678 Donna 35 Here Road 564-6879 Ahmad 43 67 Drury Lane 897-3456 Naney |21 Stuffy Street|345-7896 Billy 199 123 Apple Street 435-456-5768 suel 45 Happy Lane 456-3245 6. Exit does the obvious thing. It should print a Good bye message and simply terminate the client application. Note that the server process will still be running since it executes in an infinite loop. If the client is restarted, it should reconnect with the existing server. Ifyou want to stop the server, you can do so either from the development GUI (e.g Eclipse kill button). or from the command line with a kill signal (on Linux, this would be kill procesSID) So thats the basic idea. Ifyou havent written Python code before, you will quickly see thatit is a very accessible language with a lot of documentation and supporting materials online. Ifyou like to code, this assignment should actually be fun, certainly less painful than the C assignment DELIVERABLES: Your submission will have multiple source files. At the very least it will have a file called server.py and client.py. Feel free to add additional python files to more easily manage ENG 211 AM O Type here to search ^脈扣49 US 2018-03-14)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

# -*- coding: utf-8 -*-
import sys
import os
from pprint import pprint
import MySQLdb

file=open("data.txt","w")

#create table record(name varchar(100) not null,age varchar(100) not null,address varchar(100) not null,phone varchar (20) not null);
#INSERT INTO record (name,age,address,phone) VALUES ('a','20','test','123456789')

db = MySQLdb.connect("localhost","root","root","locate")
cursor=db.cursor()
cursor.execute("select * from record");
a = cursor.fetchall()

for line in a:
file.write(line[0]+"|"+line[1]+"|"+line[2]+"|"+line[3]+"\n")

Output of data.txt

a|20|test|123456789

Add a comment
Know the answer?
Add Answer to:
i need help with this python assignment asking for creating a simple database (client application )...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help creating a netbeans application and linking database with steps Part II – Next,...

    I need help creating a netbeans application and linking database with steps Part II – Next, build a simple Servlet called LoginServlet in your “Bank” Project. Now make it so that when the Customer logs in, the LoginServlet will get called and will validate the user id and password. At first, just make sure that the Servlet gets called correctly. So just print a simple message like “LoginServlet Running…”. Remember, to call the LoginServlet, you will need to modify the...

  • This is in C. For this assignment we will write a simple database server. We will...

    This is in C. For this assignment we will write a simple database server. We will be creating a simple database of student records, so let’s describe these first. The format of a student record is as follows: typedef struct student {     char lname[ 10 ], initial, fname[ 10 ];     unsigned long SID;     float GPA; } SREC; Part One – the Server We will create a database server. The job of the server is to accept a...

  • I am doing an assignment for a class and need a little help trying to understand...

    I am doing an assignment for a class and need a little help trying to understand how to get started on this assignment. This is needing to be program in python and any help is greatly appreciated. Distributed Computing with XML-RPC Description Common tasks in distributed computing applications often require the ability of one computer to be able to remotely invoke a procedure on another computer in the distributed system. This assignment introduces this idea further using XML-RPC and Python....

  • *****Can someone please HELP me with this assignment please, I am struggling with this assignment and...

    *****Can someone please HELP me with this assignment please, I am struggling with this assignment and would appreciate some help, needs to be done in c/c++ ******* (100 marks) In this problem, you will write a file transfer program for transferring files between two computers connected by a network. The protocol that you will implement is called the Simple File Transfer Protocol (SFTP). The complete description for SFTP is given below. PART 1 SFTP is a simple protocol for transferring...

  • i need help with this scripting assignment in power shell thanks Lab 7: PowerShell Search and...

    i need help with this scripting assignment in power shell thanks Lab 7: PowerShell Search and Report Search Report host path date Execution time nnn Directories n, nnn, nnn Files nnnnnnn Sym links nnnnnnn Old files nnnnnnn Large files nnnn, nnn Graphics files nnnnnnn Executable files nnnnnnn Temporary files n, nnn, nnn TotalFileSize nnnn, nnn Introduction Lab 7 is nearly identical to Lab 2, except it is written in PowerShell, uses no UNIX/Linux tools to do its work, creates no...

  • Hi, I need help with my comp sci assignment. The parameters are listed below, but I...

    Hi, I need help with my comp sci assignment. The parameters are listed below, but I am having trouble generating the number of occurrences of each word. Please use a standard library. Read in the clean text you generated in part 2 (start a new cpp file). Create a list of all the unique words found in the entire text file (use cleanedTextTest.txt for testing). Your list should be in the form of an array of structs, where each struct...

  • Help needed with Python 3: Dictionaries and Sets. The problem is one that asks the user to create...

    Help needed with Python 3: Dictionaries and Sets. The problem is one that asks the user to create a completed program that prompts the user for the name of a data file, and reads the contents of that data file, then creates variables in a form suitable for computing the answer to some questions. The format should be in the same manner as the attached .py file. All subsequent assignment details (.py and .csv files) can be found at this...

  • I need help in C++ assignment. please add statements and i am Xcode complier user. Requested...

    I need help in C++ assignment. please add statements and i am Xcode complier user. Requested files: CountDecades.cpp (Download) Maximum upload file size: 96 KiB Write a C++ program named CountDecades.cpp. In this program you will have two integer arrays. One named inputArray of size 20 containing the values: 83, 2, 23, 11, 97, 23, 41, 67, 16, 25, 1 , 4, 75, 92, 52, 6, 44, 81, 8, 64 in the order specified, and an empty integer array of...

  • I really need help with this python programming assignment Program Requirements For part 2, i need...

    I really need help with this python programming assignment Program Requirements For part 2, i need the following functions • get floats(): It take a single integer argument and returns a list of floats. where it was something like this def get_floats(n):   lst = []   for i in range(1,n+1):     val = float(input('Enter float '+str(i)+': '))     lst.append(val)   return lst • summer(): This non-void function takes a single list argument, and returns the sum of the list. However, it does not use...

  • I am really struggling with this assignment, can anyone help? It is supposed to work with...

    I am really struggling with this assignment, can anyone help? It is supposed to work with two files, one that contains this data: 5 Christine Kim # 30.00 3 1 15 Ray Allrich # 10.25 0 0 16 Adrian Bailey # 12.50 0 0 17 Juan Gonzales # 30.00 1 1 18 J. P. Morgan # 8.95 0 0 22 Cindy Burke # 15.00 1 0 and another that contains this data: 5 40.0 15 42.0 16 40.0 17 41.5...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT