1. What will the following piece of Java code do? In one to two short sentences,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. What will the following piece of Java code do? In one to two short sentences, describe how this Java code [does | does not] change the state of the database. public static void insert Employee (Connection conn, int sen, String fname, String Iname, double salary). ( try { String query = "insert into EMPLOYEE (SSN, Fname, Lname, Salary) values (?, ?, ?, ?)"; PreparedStatement stmt = conn.prepareStatement (query); stmt.setInt(1, ssn); stmt.setString (2, fname); stmt.setString (3, Iname); stmt.setDouble (4, salary); stmt.executeUpdate(); System.println("Successfully inserted employee record."); } catch (SQLException e) { System.out.println (e.getMessage()); 2. Beyond what the Java code does or doesn't do with the database, there is something that this Java code does wrong (or is missing). Explain why this Java code is written poorly (using a brief statement of concepts, not necessarily looking for a code solution - hint: what happens if this method is in a loop and is called a few thousand times?) 1. What will the following piece of Java code do? In one to two short sentences, describe how this Java code [does | does not] change the state of the database. public static void insert Employee (Connection conn, int sen, String fname, String Iname, double salary). ( try { String query = "insert into EMPLOYEE (SSN, Fname, Lname, Salary) values (?, ?, ?, ?)"; PreparedStatement stmt = conn.prepareStatement (query); stmt.setInt(1, ssn); stmt.setString (2, fname); stmt.setString (3, Iname); stmt.setDouble (4, salary); stmt.executeUpdate(); System.println("Successfully inserted employee record."); } catch (SQLException e) { System.out.println (e.getMessage()); 2. Beyond what the Java code does or doesn't do with the database, there is something that this Java code does wrong (or is missing). Explain why this Java code is written poorly (using a brief statement of concepts, not necessarily looking for a code solution - hint: what happens if this method is in a loop and is called a few thousand times?)
Expert Answer:
Answer rating: 100% (QA)
1 This Java code will insert a new record into the EM... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Data set Theory Assume an informational record with one association parent including matches (a, b) where a can't try not to be a parent of b. (a) Write a Datalog demand which gives the graph of...
-
The new line character is utilized solely as the last person in each message. On association with the server, a client can possibly (I) question the situation with a client by sending the client's...
-
Using monthly data for Meta since its IPO date of 31/12/2019, estimate equity beta for Meta. Compare your estimate of Metas equity beta with Facebooks beta provided by Yahoo Finance and comment on...
-
Refer to the Fresh Springs Bottling Department Data Set and your answer to S5-19. Complete Steps 3 and 4 of the process costing procedure: Summarize total costs to account for and then compute the...
-
The following trial balance of Sergei Asbrecht Co. does not balance. Each of the listed accounts has a normal balance per the general ledger. An examination of the ledger and journal reveals the...
-
Xie Company identified the following activities, costs, and activity drivers for 2017. The company manufactures two types of go-karts: deluxe and basic. Required 1. Compute a single plantwide...
-
Modern Building Supply sells various building materials to retail outlets. The company has just approached Linden State Bank requesting a $300,000 loan to strengthen the Cash account and to pay...
-
1 = We know that all the statements [4] Consider the system (0.3)-(0.4) in the particular case f(r) = proven in Problem [3] apply to this case, so for example, we know that c2 7 = - 1 12 (0.6) de and...
-
While working on the multiplication problem 39 20, Marcus says this: Four times 20 is 80, so 40 times 20 is 800. Now take away 1, so the answer is 799. Is Marcuss method correct or not? If it is not...
-
What characteristics of a company do you think influence it to use flex time with its workers versus one which has employer-directed irregular hours?
-
The demand for land is a derived demand. Think of a popular location near your school. What determines the demand for land in that area? What outputs are sold by businesses located there? Discuss the...
-
Each year, lists of the fastest-growing and fastest-dying industries in the United States are published by various sources. Do some research to find three industries from each of these two lists for...
-
In 2017, the CEO of Google, Sundar Pichai, earned $1,333,557 in total compensation (salary, bonuses, and other compensation) and Cristian Samper, the president and CEO of the non-profit Wildlife...
-
According to the Bureau of Labor Statistics, the average weekly earnings of production and nonsupervisory employees in education and health services was $760 in May 2018, up from $607 in May 2008....
-
What is the overall charge on the side chain of lysine when one third (33%) of the side chains are deprotonated?
-
From 1970 to 1990, Sri Lanka's population grew by approximately 2.2 million persons every five years. The population in 1970 was 12.2 million people.What is the best formula for P, Sri Lanka's...
-
Frank, age 35, and Joyce, age 34, are married and file a joint income tax return for 2012. Their salaries for the year total $83,000 and they have taxable interest income of $4,000. They have no...
-
In the 2012 tax year, Michelle paid the following amounts relating to her 2010 tax return: Tax deficiency..........................................$5,000 Negligence...
-
For each of the following situations, indicate whether the taxpayer(s) is (are) required to file a tax return for 2012. Explain your answer. a. Helen is a single taxpayer with interest income in 2012...
-
Personalized medicine may be used a. to characterize types of tumors. b. to predict the outcome of certain types of cancers. c. to determine the proper dosage of drugs. d. in all of the above.
-
Tumor-suppressor genes promote cancer when a. they are overexpressed. b. they are expressed in the wrong cell type. c. their function is inactivated. d. they are expressed at the wrong stage of...
-
A mutant gene that promotes cancer when it is overexpressed is called a. a tumor-suppressor gene. b. an oncogene. c. both a and b. d. neither a nor b.
Study smarter with the SolutionInn App