n looking at the JDBC code, how can you tell what type of Database Management System being used in this code? import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; public class guiDBExample extends JFrame implements ActionListener {     String inputNumber;     int sqlNumber;     String partName = null;         String partDescription = null;     String partPrice = null;     JTextField name;     JTextField number;          public guiDBExample()     {         buildGUI();     }     public final void buildGUI() {         JPanel panel1 = new JPanel();         JPanel panel2 = new JPanel();         JPanel panel3 = new JPanel();         JPanel panel4 = new JPanel();         JPanel panel5 = new JPanel();                 getContentPane().add(panel1, "North");         getContentPane().add(panel2, "West");         getContentPane().add(panel3, "Center");         getContentPane().add(panel4, "East");         getContentPane().add(panel5, "South");                      JLabel partNumber = new JLabel("Part number ");         panel1.add(partNumber);                  number = new JTextField("", 10);         panel1.add(number);                          JLabel partNameLabel = new JLabel("Name ");         panel1.add(partNameLabel);                  name = new JTextField("", 15);         panel1.add(name);           JButton read = new JButton("Read");         read.addActionListener(this);         panel5.add(read);         setDefaultCloseOperation(EXIT_ON_CLOSE);     }     public void getPartName()             throws SQLException, ClassNotFoundException {             Class.forName("com.mysql.jdbc.Driver");             System.out.println("Driver loaded");             // Establish a connection             Connection connection = DriverManager.getConnection             ("jdbc:mysql://localhost/test");                          //Sample connection if you have a password set on your machine             //Connection connection = DriverManager.getConnection             //        ("jdbc:mysql://localhost/test","root", "MySQL");                          System.out.println("Database connected");             // Create a statement             Statement statement = connection.createStatement();             // Execute a statement                          ResultSet resultSet = statement.executeQuery             ("select * from Inventory WHERE partNumber = " + sqlNumber + ";");             // Iterate through the result and print the student names             while (resultSet.next())             {                partName = resultSet.getString(2);              }             // Close the connection             connection.close();             }                            public void actionPerformed(ActionEvent action) {                           if(action.getActionCommand().equals("Read"))         {             try {                 inputNumber = number.getText();                 sqlNumber = Integer.parseInt(inputNumber);                 getPartName();             } catch (ClassNotFoundException e) {                 // TODO Auto-generated catch block                 e.printStackTrace();             } catch (SQLException e) {                 // TODO Auto-generated catch block                 e.printStackTrace();             }             name.setText(partName);         }     }           public static void main(String[] args) {              guiDBExample ex = new guiDBExample();              //the next statement correctly sizes your GUI              ex.pack();              ex.setVisible(true);                }   }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

In looking at the JDBC code, how can you tell what type of Database Management System being used in this code?

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class guiDBExample extends JFrame implements ActionListener {

    String inputNumber;
    int sqlNumber;
    String partName = null;    
    String partDescription = null;
    String partPrice = null;
    JTextField name;
    JTextField number;
    
    public guiDBExample()
    {
        buildGUI();
    }

    public final void buildGUI() {
        JPanel panel1 = new JPanel();
        JPanel panel2 = new JPanel();
        JPanel panel3 = new JPanel();
        JPanel panel4 = new JPanel();
        JPanel panel5 = new JPanel();
       
        getContentPane().add(panel1, "North");
        getContentPane().add(panel2, "West");
        getContentPane().add(panel3, "Center");
        getContentPane().add(panel4, "East");
        getContentPane().add(panel5, "South");    
        
        JLabel partNumber = new JLabel("Part number ");
        panel1.add(partNumber);
        
        number = new JTextField("", 10);
        panel1.add(number);
                
        JLabel partNameLabel = new JLabel("Name ");
        panel1.add(partNameLabel);
        
        name = new JTextField("", 15);
        panel1.add(name);
 
        JButton read = new JButton("Read");
        read.addActionListener(this);
        panel5.add(read);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
    }

    public void getPartName()
            throws SQLException, ClassNotFoundException {
            Class.forName("com.mysql.jdbc.Driver");
            System.out.println("Driver loaded");
            // Establish a connection
            Connection connection = DriverManager.getConnection
            ("jdbc:mysql://localhost/test");
            
            //Sample connection if you have a password set on your machine
            //Connection connection = DriverManager.getConnection
            //        ("jdbc:mysql://localhost/test","root", "MySQL");
            
            System.out.println("Database connected");
            // Create a statement
            Statement statement = connection.createStatement();
            // Execute a statement
            
            ResultSet resultSet = statement.executeQuery
            ("select * from Inventory WHERE partNumber = " + sqlNumber + ";");

            // Iterate through the result and print the student names
            while (resultSet.next())
            {
               partName = resultSet.getString(2);
             }
            // Close the connection
            connection.close();
            }        
            
 
    public void actionPerformed(ActionEvent action) {
        
        
        if(action.getActionCommand().equals("Read"))
        {
            try {
                inputNumber = number.getText();
                sqlNumber = Integer.parseInt(inputNumber);
                getPartName();
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            name.setText(partName);

        }

    }
    
     public static void main(String[] args) {
             guiDBExample ex = new guiDBExample();
             //the next statement correctly sizes your GUI
             ex.pack();
             ex.setVisible(true);
         
     }
 
}

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY