Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. What will the following piece of Java code do? In one to two short sentences, describe how this Java code [does | does

 

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?)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

1 This Java code will insert a new record into the EM... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

What is a cloud - native application?

Answered: 1 week ago