DBC Database Application Using Assignment

Download Solution Order New Solution

Assignment Task

Fully documented and narrated video of the complete application. showing all the requirements of the prescribed graphical user design with the operations of insert, update, retrieve, search and delete fully functional as outlined in the document. This is an individual video presentation.

Instructions

Using MySQL Workbench, create a database named my band a table named book inside it with columns

  • ID
  • Name
  • Edition
  • Price

Create database my DB use my DB CREATE TABLE mydb book (ID INT NOT NULL AUTO INCREMENT Name VARCHAR (250) NULL Edition` INT NULL Price INT NULL PRIMARY KEY (ID)

Creating a Java Project in Eclipse

Open Eclipse IDE and click on the Java Project under the new section of the File Menu (File>>New>>Java Project). Now give a name to your project (aJavaCrud as in this example) and click on “Finish”.

Note

WindowBuilder is required but not pre-installed in Eclipse. To install WindowBuilder for graphical design capabilities follow the below instructions:

  • In the Eclipse main Menu bar, click on help,
  • Click Install New Software
  • Click Add
  • Under Name, type WindowBuilder,
  • Under Location, copy:
  • Click Add
  • Check on the checkboxes
  • Click next and allow it to install the available options

After installing WindowBuilder in Eclipse, right-click on your Project “src” and create a new Java class (New>>Class>>Other>>WindowBuilder>>Swing Designer>>Application Window) as shown below:

  • Now give a name to your class (e.g., JavaCrud)

Change to Design view and create the following design using the WindowBuilder Palette:

Adding MySQL connector jar file in Eclipse

  • In order to connect your java program with MySQL database, you need to include MySQL JDBC driver which is a JAR file, namely mysql-connector-java-8.0.31.jar. The version number in the Jar file can be different. 
  • After visiting the link, select platform independent from the drop-down menu and then download the Platform Independent (Architecture Independent), ZIP Archive. Extract the zip archive and you will get the jar file.
  • Next, you have to include this jar file in your program so that you will be able to connect your Java program with MySQL database.
  • Right-click on the project, go to the properties section then select Java Build Path and click on the Add External JARs button.
  • Click on Add External Jars and navigate to where your unzipped Jar file is and select and open the jar file. Click Apply and Close.

Adding rs2xml.jar file in Eclipse

Download or use the rs2xml.jar file provided for in class. Add it as an External JAR following the above steps for configuring the MySQL connector jar file. Note: This Jar file is required for proper retrieval and display of database results into your Java table.

Connecting Java Program with MySQL Database

After adding the required jar files, now you are ready to connect your Java program to MySQL Database.

  • Establish a connection using DriverManager.getConnection(String URL) which returns a Connection reference.
  • In the String URL parameter, you have to write like this:
    • jdbc “root”, “root” where:
    • JDBC is the API.
    • MySQL is the database.
    • CloudSQLhost/localhost is the name of the MySQL server.
    • 3306 is the port number.
    • MyDB is the database name. If your database name is different, then you have to replace this name with your database name.
    • The first root is the username of the MySQL database. It is the default username for the MySQL database.
    • The second root is the password that you gave while installing the MySQL database.

Note:

  • The current MySQL user name and password MUST be used
  • SQL Exception might occur while connecting to the database, so you need to surround it with the try-catch block.

This IT and Computer Science has been solved by our PHD Experts at My Uni Paper.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.