如何使用javascript函数以15分钟的间隔获取数据?

时间:2014-11-24 06:58:56

标签: javascript mysql jsp

我的数据库中有yyyy-mm-dd hh:mm:ss格式的Date_time字段。我在我的数据库中存储了8天的数据。现在我想要每15分钟一次的数据。它的解决方案是什么?请帮我。 现在我想每15分钟一次这个值。我能做什么???我对javascript n jquery一无所知。

my code is:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page import="java.sql.*" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Fetching data from the database</title>

</head>
<body>
    <table border="2">
        <tr>
            <th>Inv_id</th>
            <th>Inv_phase1_V</th>
            <th>Inv_phase1_A</th>
            <th>Inv_phase1_kW</th>
        </tr>
            <%
            try
            {
                Class.forName("com.mysql.jdbc.Driver");
                String url="jdbc:mysql://localhost:3306/solar";
                String username="root";
                String password="root";
                Connection conn=DriverManager.getConnection(url,username,password);
                String query="select Inv_id,Inv_phase1_V,Inv_phase1_A,Inv_phase1_kW from inverter_detail";
                Statement stmt=conn.createStatement();
                ResultSet rs=stmt.executeQuery(query);

                while(rs.next())
                {
                    String Inverter_id = rs.getString("Inv_id");
                    Double voltage = rs.getDouble("Inv_phase1_V");
                    Double ampere = rs.getDouble("Inv_phase1_A");
                    Double kiloWatt = rs.getDouble("Inv_phase1_kW");
                %>
                    <tr>
                        <td><%=Inverter_id%></td>
                        <td><%=voltage%></td>
                        <td><%=ampere%></td>
                        <td><%=kiloWatt%></td>
                    </tr>
                <%
                }
                %>
                <%
                    rs.close();
                    stmt.close();
                    conn.close();
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
                %>
        </table>
    </body>
</html>

0 个答案:

没有答案