How to fetch data from database in table at every 15 minute?

前端 未结 2 1386
攒了一身酷
攒了一身酷 2021-01-26 10:24

I had store 8 days data in mysql database. I want to retrieve those data in jsp page at every 15 minute . please give some hint to resolve my problem..

2条回答
  •  臣服心动
    2021-01-26 10:46

    The simplest way would be to create meta refresh in header of JSP.

    
    
    
    

    http://www.w3schools.com/tags/att_meta_http_equiv.asp

    For fetching data use:

    <%@ page import="java.sql.*" %>
    <% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>
    
    
    
        Fetching Data From a Database
    
    
    
        

    Database Lookup

    Please enter the ID of the publisher you want to find:

    Fetching Data From a Database

    <% Connection connection = DriverManager.getConnection( "jdbc:odbc:data", "userName", "password"); Statement statement = connection.createStatement(); String id = request.getParameter("id"); ResultSet resultset = statement.executeQuery("select * from tableName where id = '" + id + "'") ; if(!resultset.next()) { out.println("Sorry, could not find that publisher. " + "Please try again."); } else { %>
    ID Name City State Country
    <%= resultset.getString(1) %> <%= resultset.getString(2) %> <%= resultset.getString(3) %> <%= resultset.getString(4) %> <%= resultset.getString(5) %>

    <% } %>

提交回复
热议问题