Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //initialize the connection
- try{
- Connection conn1=DriverManager.getConnection("jdbc:mysql://localhost/test","root","****");
- String query1= "SELECT * FROM student_table";
- Statement stmt1= conn1.createStatement();
- ResultSet res1=stmt1.executeQuery(query1);
- // Print the result
- System.out.println("id tt "+"namett "+"classttt "+"agen");
- while(res1.next()){
- System.out.println(res1.getString("id")+"tt "
- +res1.getString("name")+"tt "
- +res1.getString("class")+"tt "
- +res1.getString("age"));
- }
- }catch(Exception e){
- System.err.println(e);
- }
- }
Add Comment
Please, Sign In to add comment