Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <%@ page import ="java.sql.*" %>
- <meta HTTP-EQUIV="refresh" CONTENT="3">
- <%
- String usuario = "root";
- String senha = "root";
- String driver ="com.mysql.jdbc.Driver";
- String url ="jdbc:mysql://localhost/arduino";
- Connection conexao;
- Statement statement;
- ResultSet resultSet;
- try{
- Class.forName(driver);
- conexao = DriverManager.getConnection(url, usuario, senha);
- statement = conexao.createStatement();
- resultSet = statement.executeQuery("Select * From tabelasensor ORDER BY hora DESC LIMIT 10");
- while(resultSet.next()){ %>
- <body>>
- <center>
- <table border="1">
- <tr><td>
- <font size="10">
- <font> Data : </font>
- <font> <% out.println(resultSet.getString(1)); %> </font> <br>
- <font color="#0000FF" > Temperatura Celsius : </font>
- <font> <% out.println(resultSet.getString(2)); %> </font> <br>
- a
- </font>
- </td> </tr>
- </table>
- </center>
- <br> <br>
- </body>
- <%
- }
- }catch(ClassNotFoundException exDriver){
- out.print("Erro Driver : " +exDriver);
- }catch (SQLException ex){
- out.print("Erro : " +ex);
- }
- %>
Add Comment
Please, Sign In to add comment