///// 
import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
 
public class JdbcExample {
 
    public static void main(String[] args) {
       String cls = "com.mysql.jdbc.Driver";
       String url = "jdbc:mysql://10.1.10.27/test";  ////kit.znu.edu.ua/mpes";
       String un  = "bsu";
       String  psw = "55555";
       System.out.println(" cls="+ cls);
        try {
            Class.forName(cls);
        } catch (ClassNotFoundException ex) {
            ///Logger.getLogger(JdbcExample.class.getName()).log(Level.SEVERE, null, ex);
            System.out.println("!!!! ClassNotFoundException driver not found......");
            System.out.println("!!!! "+ex);
            //System.out.println(JdbcExample.class.getName());
            System.exit(16);
        }
        Connection conn = null;
        System.out.println(" url="+ url); 
        try {
            conn =(Connection) DriverManager.getConnection(url,un, psw);
        } catch (SQLException ex) {
            ///Logger.getLogger(JdbcExample.class.getName()).log(Level.SEVERE, null, ex);
            System.out.println("!!!! Connection falue......");
            System.out.println("!!!! "+ex);
            System.exit(8);
        }
       String selectTableSQL = "SELECT * from stud";
       Statement stmnt;
       ResultSet rs;
       try {
            stmnt= (Statement) conn.createStatement();
            rs=stmnt.executeQuery(selectTableSQL);
         while (rs.next()) {
            //Integer id = rs.getInt("ID_EXAMPLE_TABLE");
            //String info = rs.getString("TEXT_FIELD");
            //System.out.print("id: " + id);
            //System.out.println(", info: " + info);
            System.out.print( " "+rs.getString("fio"));
            System.out.print( " "+rs.getString("name"));
            System.out.print( " "+rs.getString("grup"));
            System.out.print( " "+rs.getString("tel"));
            System.out.print( " "+rs.getString("sex"));
            System.out.print( " "+rs.getString("birth"));
            System.out.println(" ");



         }
        } catch (SQLException e) {
    System.out.println(e.getMessage());
}
    }
}