Answered step by step
Verified Expert Solution
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started