package dbms_basic;
import java.sql.*;
public class Dbms_Basic {
public static void main
(String[] args
) { // TODO code application logic here
String url
="jdbc:mysql://localhost:3306/student"; try {
Class.forName("com.mysql.jdbc.Driver");
System.
out.
println("Now connecting to databse...\n"); System.
out.
println("Connected !!!\n"); stmt=con.createStatement();
System.
out.
println("Asking for query...\n"); ResultSet rs
=stmt.
executeQuery("select * from cse"); System.
out.
println("we got it !!!\n"); System.
out.
println("Time to display it...\n"); while(rs.next())
{
System.
out.
println(rs.
getInt(1)+" "+rs.
getString(2));
}
System.
out.
println("ok it's done !!!\n"); stmt.close();
con.close();
System.
out.
println("connection close !!!\n");
}
}
cGFja2FnZSBkYm1zX2Jhc2ljOwppbXBvcnQgamF2YS5zcWwuKjsKcHVibGljIGNsYXNzIERibXNfQmFzaWMgewoKCnB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpIHsKICAgIC8vIFRPRE8gY29kZSBhcHBsaWNhdGlvbiBsb2dpYyBoZXJlCiAgICBDb25uZWN0aW9uIGNvbj1udWxsOwogICAgU3RhdGVtZW50IHN0bXQ9bnVsbDsKICAgIFN0cmluZyB1cmw9ImpkYmM6bXlzcWw6Ly9sb2NhbGhvc3Q6MzMwNi9zdHVkZW50IjsKICAgIFN0cmluZyB1c2VyPSJyb290IjsKICAgIFN0cmluZyBwYXNzPSJzeXN0ZW0iOwogICAgdHJ5IHsKICAgICAgICBDbGFzcy5mb3JOYW1lKCJjb20ubXlzcWwuamRiYy5Ecml2ZXIiKTsKCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJOb3cgY29ubmVjdGluZyB0byBkYXRhYnNlLi4uXG4iKTsKICAgICAgICBjb249RHJpdmVyTWFuYWdlci5nZXRDb25uZWN0aW9uKHVybCx1c2VyLHBhc3MpOwogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiQ29ubmVjdGVkICEhIVxuIik7CiAgICAgICAgc3RtdD1jb24uY3JlYXRlU3RhdGVtZW50K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