I need to print the output from the database as a table
public static void main(String[] args) {
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/walmart?characterEncoding=utf8","root","toor");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from salesperson");
System.out.println(" Employee ID "+" Employee Name "+" Contact "+" Region "+"Sales");
while(rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getInt(3)+" "+rs.getString(4)+" "+rs.getFloat(5));
//step5 close the connection object
con.close();
}
catch(Exception e){ System.out.println(e);}
} }