Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is for Java, I use netbeans Please do not just post code already found on t

ID: 3855234 • Letter: T

Question

This is for Java, I use netbeans

Please do not just post code already found on this site, I would like a different answer.

Please test code prior to publishing

The objective of this assignment is to allow you to work with JDBC via an ODBC-connected Access database.

Your first task for this assignment is to locate and set up the "exampleMDB.mdb" file in the supplemental chapters section of the CD-rom that came with your Liang text. Copy this file to your hard drive. Next, create an ODBC connection to this database called "assignment8".

Next, create a simple Java program that connects to this database using JDBC. Your program should then query this database's "student" table and display a list of all the students' names in alphabetic order (based upon last name).

If you implement your program correctly, this is the output you should see:

Rick R. Carter

Frank E. Jones

Joy P. Kennedy

Toni R. Peterson

Josh R. Smith

Jean K. Smith

George K. Smith

Jacob R. Smith

John K. Stevenson

Patrick R. Stoneman

Josh R. Woo

Explanation / Answer

import java.sql.*;
class EmployeeDataBaseConnection{
public static void main(String args[]){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/employee","root","root");
//here employee is database name, root is username and password
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from emp order by last name asec");
while(rs.next())
System.out.println(rs.getString(2));
con.close();
}catch(Exception e){ System.out.println(e);}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote