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
-
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,...
-
If automatic stabilizers increase the federal budget balance by $60 billion for every 1 percent increase in real GDP growth, what will happen to the federal budget balance if the economy falls into a...
-
Simplify and check using a graphing calculator cot x CSC X 2 + 1 cscx
-
Tennessee law imposes durational-residency requirements on persons and companies wishing to operate retail liquor stores, requiring applicants for an initial license to have resided in the state for...
-
W. C. Sanders, owner of Fort Engines, a producer of heavy-duty snow blower engines, needs to develop an aggregate plan for the coming year. The company currently uses 20 individuals working 160...
-
Jessa owns a house and lot on 9th Avenue. She sells the house to the Hartley family, who wish to have a conveyance from her that says, to Harriet Hartley for life, remainder to her son, Alexander...
-
You have just been hired by Internal Business Machines Corporation (IBM) in their capital budgeting division. Your first assignment is to determine the free cash flows and NPV of a proposed new type...
-
To protect soil from erosion, some farmers plant winter cover crops such as winter wheat and rye. In addition to conserving soil, cover crops often increase crop yields in the row crops that follow...
-
What is Macbeth's nemesis, or fatal flaw in the play 'Macbeth'? Name and explain two examples of his hubris (pride or excessive self-confidence) in the play.
-
What precautions and strategies should be considered to address the potential impact of synthetic media on public perception as it will become even more difficult to tell apart what is real and fake?
-
You conduct a Physics experiment on Earth and on Mars. In this experiment, you push on your 60 kg partner who is standing on a frictionless level floor (of course) with 270 N of force parallel to the...
-
23. CustomMetalworks in Oregon produces guy wire attachments for towers (cell, broadcasting, etc.) according to customer order. The company has determined that guy attachments can be produced on...
-
What is the 8-bit sign extended representation of the 4-bit unsigned number Ob1001? 11111001 10011001 00001001 10010000 10001001
-
According to the data collected from United Airlines and presented in the below multi-attribute matrix, which airline is preferred by non-business travelers? CONSIDERATION SET OF AIRLINE ALTERNATIVES...
-
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?
-
Using the knowledge you gained from your interview in mini case 1 , design an interface for the individual you interviewed. What interface design modifications are you making so that the program will...
-
The capital market line, CML, is the graph of the risk and return of portfolio combinations consisting of the risk-free asset and: A. Any risky portfolio. B. The market portfolio. C. The leveraged...
-
Relative to portfolios on the CML, any portfolio that plots above the CML is considered: A. Inferior. B. Inefficient. C. Unachievable.
Core Values And Organizational Change Theory And Practice 1st Edition - ISBN: 9812569030 - Free Book
Study smarter with the SolutionInn App