Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet How to display mysql database records as per clock timing?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


rakesh dilip patil
How to display mysql database records as per clock timing?
1 Answer(s)      2 years and 7 months ago
Posted in : JSP-Servlet


I want to display database records as per clock timing.


Advertisement
View Answers

April 28, 2012 at 3:28 PM


import java.sql.*;

class RetrieveData 
{
    public static void main(String[] args) throws Exception
    {
                Class.forName("com.mysql.jdbc.Driver").newInstance();
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root" );
        Statement st=conn.createStatement();
        ResultSet rs=st.executeQuery("select * from data");

        while(rs.next()){
            String name=rs.getString("name");
            String address=rs.getString("address");
            String contact=rs.getString("contactNo");
            String email=rs.getString("email");

            System.out.println(name+" \t "+address+" \t "+contact+" \t "+email);
            Thread.sleep(2000);
        }
    }
}


Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com