Write a java program to display list of college names from college table.
(Assume
College table (CID, CName, addr) is already created.
import java.sql.*;
class Slip26 {
public static void main(String args[]) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/collegedb", "root", "");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select cname from college");
System.out.println("<<<<College Name>>>>");
System.out.println("===================");
while (rs.next()) {
System.out.println(rs.getString(1));
}
con.close();
}
}