Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Data Structure Expert

Project:

1. install MySQL DBMS (and DB/language connector) software on your machine,

2. create World database using MySQL (using command files - NOT a Setup PROGRAM)

3. write a Java or C# or ... program to access the DB.

Batch processing is used:

• queries (data retrieval & update requests) are in a transaction file
• output sent to a log file.

Steps:

A. Download & install MySQL on your machine.

B. Download & install appropriate connector for MySQL which allows Java or C# to interact with a MySQL database.

C. SETUP [NOT A PROGRAM]: Use MySQL and the script files provided (which need a slight alteration) to create the WorldDB consisting of Country and CountryLanguage tables (though NOT the City table).

D. UserApp PROGRAM with 1 (or more) additional class (in separate file)

1. program does batch processing (using "INPUT STREAM Processing Algorithm" [that is, loop til EOF { read 1 transaction, then deal with it completely } ].

2. Trans file & Log file handling are done in main program or a separate UI class

3. 4 local methods (in UserApp), SelectHandler, InsertHandler, DeleteHandler, UpdateHandler - each takes the transaction line (when it' called upon by Main) and builds (somehow) the appropriate sqlString.

4. 2 methods in a SEPARATE CLASS, DBAccess (in a physically separate file), do actual SQL DB interaction:

a. RetrieveData for handling SELECTs
b. ChangeData for handling INSERTs & DELETEs & UPDATEs

For each transaction:

1. Echo original transaction request (from transaction file)

2. For INSERTs & DELETEs (but not SELECTs or UPDATEs),

show actual SQL statement which your program BUILT, which it sent to the DBS for processing

3. Show results from executing the "query" - i.e.,

a. a "table" for a SELECT
b. a reassurance message for changes: OK, INSERT done
OK, DELETE done
OK, UPDATE done
4. Write out a blank line.

Each transaction on a new line - 1st column is transCode: S, I, D, U (always caps).

S(elect) transactions (RETRIEVE data from DB)

- transaction data is an actual SQL statement to be used "as is".
    [This is not a common/proper programming approach, but time is short so...].

- Allow for 0 or 1 or Many ROWS to be returned to the program from the DB.

- rdr.FieldCount gives the number of COLUMNS there'll be for a result set

- "table" printed to TheLog file does NOT NEED TO:

- be in a box (e.g., like a typical interactive result in the command window)

- have column headings (but if it does,
    DON'T use what's in my demo program &
    DON'T hardcode the header labels (as my demo program does)

- be perfectly aligned since this SINGLE GENERIC METHOD doesn't know 
    what data type rdr[0] or rdr[1] or the other columns are.

U(pdate) transactions (CHANGE data in DB)
- transaction data is an actual SQL statement to be used "as is"

D(elete) transactions (CHANGE data in DB)
- transaction data is NOT an SQL statement
- your program has to construct it from the "parameters" supplied
- Basic format for a simple DELETE SQL statement:
    DELETE FROM Country WHERE Name = 'Disneyland'
  Transaction data (i.e., the parameters) would look like:
     D Country|Name|'Disneyland'

I(nsert) transactions (CHANGE data in DB)
   - transaction data is NOT an SQL statement
           - your program has to construct it from the "parameters" supplied using various string-handling methods (e.g., Split, +, etc.)
- 2 basic formats for simple SQL INSERT statements:

1) all-columns INSERT (so column names NOT specified in SQL statement):

INSERT INTO CountryLanguage VALUES ('USA','C#','F',0.01)
Transaction data (parameters) looks like:
I CountryLanguage|'USA','C#','F',0.01

2) some-columns INSERT (so column names MUST BE specified in SQL stmt):

INSERT INTO Country(Code, Name) VALUES ('HEX','Hexland')

Transaction data (parameters) looks like:

I Country|(Code, Name)|'HEX','Hexland'

Data Structure, Computer Science

  • Category:- Data Structure
  • Reference No.:- M9310957
  • Price:- $70

Priced at Now at $70, Verified Solution

Have any Question?


Related Questions in Data Structure

Problem regarding the management program

Problem: Looks like its just adding a save and load feature to the same file you sent me for python 3.5 Until now, you have had to leave your team management program running on your computer indefinitely since you did no ...

Data Communication Delivering Information anywhere

Topic: Data Communication Delivering Information anywhere. Write a 9-12 pages paper in which you: Present an overview of the origin and history of the concept. Describe the current use of and attitude toward the concept. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As