follow the instructions that are uploaded. try ( ) { // establish connection to database Connection connection
Fantastic news! We've Found the answer you've been seeking!
Question:
follow the instructions that are uploaded.
Transcribed Image Text:
try ( ) { // establish connection to database Connection connection = DriverManager.getConnection ( url, user: username, password); // create Statement for querying database Statement statement = connection.createStatement(); // query database ResultSet resultSet = statement.executeQuery( string: "SELECT AuthorID, FirstName, LastName FROM authors"); // process query results ResultSetMetaData metaData = resultSet.getMetaData(); int numberOfColumns = metaData.getColumnCount(); System.out.println(x: "Authors Table of Books Database:\n"); //columns start at 1 NOT zero !! - GJK for (int i = 1; i <= numberOfColumns; i++) { } System.out.printf( format: "%-8s\t", args: metaData.getColumnName (i)); System.out.println(); while (resultSet.next()) { for (int i = 1; i <= numberOfColumns; i++) { System.out.printf( format: "%-8s\t", args: resultSet.getObject (i)); System.out.println(); } //end while System.out.println(x: "\nAuthors Table - Column Attributes: "); for (int i = 1; i <= numberOfColumns; i++) { System.out.printf( format: "%-8s\t", System.out.printf( format: "%-8s\t", System.out.printf( format: "%-8s\t", System.out.printf( format: "\n"); args: metaData.getColumnName (i)); args: metaData.getColumnTypeName (i)); args: metaData.getColumnClassName (i)); System.out.println(); try ( ) { // establish connection to database Connection connection = DriverManager.getConnection ( url, user: username, password); // create Statement for querying database Statement statement = connection.createStatement(); // query database ResultSet resultSet = statement.executeQuery( string: "SELECT AuthorID, FirstName, LastName FROM authors"); // process query results ResultSetMetaData metaData = resultSet.getMetaData(); int numberOfColumns = metaData.getColumnCount(); System.out.println(x: "Authors Table of Books Database:\n"); //columns start at 1 NOT zero !! - GJK for (int i = 1; i <= numberOfColumns; i++) { } System.out.printf( format: "%-8s\t", args: metaData.getColumnName (i)); System.out.println(); while (resultSet.next()) { for (int i = 1; i <= numberOfColumns; i++) { System.out.printf( format: "%-8s\t", args: resultSet.getObject (i)); System.out.println(); } //end while System.out.println(x: "\nAuthors Table - Column Attributes: "); for (int i = 1; i <= numberOfColumns; i++) { System.out.printf( format: "%-8s\t", System.out.printf( format: "%-8s\t", System.out.printf( format: "%-8s\t", System.out.printf( format: "\n"); args: metaData.getColumnName (i)); args: metaData.getColumnTypeName (i)); args: metaData.getColumnClassName (i)); System.out.println();
Expert Answer:
Answer rating: 100% (QA)
Heres the improved Java code that implements the console application requirements incorporating feed... View the full answer
Related Book For
Principles of Information Systems
ISBN: 978-0324665284
9th edition
Authors: Ralph M. Stair, George W. Reynolds
Posted Date:
Students also viewed these programming questions
-
Introduction A literature review is undertaken to understand the available scientific knowledge on a particular topic. It provides an overview of all the evidence-based information that is available....
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Parisian Cosmetics Company is planning a one-month campaign for September to promote sales of one of its two cosmetics products. A total of $140,000 has been budgeted for advertising, contests,...
-
Solve the following homogeneous linear ordinary differential equations. What is the dimension of the solution space? (a) u" - 4u = 0 (b) u" - 6u' + 8u = 0 (c) u - 9u = 0 (d) u"" + 4u - u" - 16u - 12u...
-
In this task, you are required to use several applications of bitwise operators. It is composed of several functions that must perform certain bitwise operations. Implement the following basic bit...
-
Define a forward stock split. What is the major reason for a forward stock split?
-
A. Describe some of the attributes of an ideal risk indicator for stock market investors. B. On the Internet, go to Yahoo! Finance (or msn Money) and download weekly price information over the past...
-
Regarding Northwestern Memorial Hospital v. Ashcroft, Do you think the court would have ruled otherwise had the records involved a medical procedure other than abortion? Does anything in HIPAA...
-
G-Tech's monthly demand is 250 units. You are in charge of the inventory department. You know that the holding cost is $60 per unit and ordering cost is $100 per order. What is the EOQ? What is the...
-
Determine the number and nature of the roots of the following quadratic equations by solving for the discriminant. 1. y+5y-6-0 2.-2y-8-8y 3. 3y+7y+10=3 4. y(4y-5)=6y+1 5. -2y-9--9y-y
-
You log into a closed group on a social networking site and read a posting from a fellow nursing student. The posting describes in detail the complex care the student gave to a 9 y/o patient in a...
-
How do advanced computational fluid dynamics (CFD) simulations aid in optimizing the design of hydraulic structures such as dams and spillways to ensure efficient water management and mitigate...
-
Case Study 2b - Starting Design Thinking for team collaboration In preparation for your leadership role with a work team to innovate, Carol wants to review your understanding of the Design Thinking...
-
Review the material from the lesson, text book, and video on how the unemployment rate is calculated by the Bureau of Labor Statistics (BLS). Question To Answer: Did I tell l you that I am going to...
-
Describes the challenges and successes encountered by GE's Aviation... Describes the challenges and successes encountered by GE's Aviation business in implementing a teaming work structure and...
-
General Electric Capital, a division of General Electric, uses long-term debt extensively. In a recent year, GE Capital issued $11 billion in long-term debt to investors, then within days filed legal...
-
Contrast and compare three popular OSs for personal computers.
-
What is the difference between knowledge and information?
-
What is multitasking?
-
Why do you think there was a reduction of cases where fraud was detected by internal audit and internal controls in the 2006-2008 comparison survey by the ACFE? Does it mean that these elements of...
-
In 2005, a group of concerned shareholders of Johnson & Johnson requested the board of directors establish a policy of, whenever possible, separating the roles of the chair and CEO, so that an...
-
Evaluate the ethicality of the corporate governance systems at Microsoft based on the discussion in the text.
Study smarter with the SolutionInn App