<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
-------------------------------------------------------------------------------------
<sql:setDataSource var="db" driver="com.mysql.cj.jdbc.Driver"
url="jdbc:mysql://localhost:3306/my_db?useUnicode=true&characterEncoding=utf-8"
user="root" password="1234"/>
<%-- ?serverTimezone=UTC --%>
-------------------------------------------------------------------------------------
<sql:query dataSource="${db}" var="rs">
SELECT * from city where countrycode='AUS';
</sql:query>
<table>
<c:forEach var="row" items="${rs.rows}">
<tr>
<td><c:out value="${row.name}"/></td>
<td><c:out value="${row.district}"/></td>
<td><c:out value="${row.population}"/></td>
</tr>
</c:forEach>
</table>
-------------------------------------------------------------------------------------
<%--
<sql:update dataSource="${db}" var="result">
INSERT INTO websites (name,url,alexa,country) VALUES ('111', 111, 111, '111');
</sql:update>
-------------------------------------------------------------------------------------
<c:set var="aa" value="3"/>
<sql:update dataSource="${db}" var="count">
DELETE FROM websites WHERE Id = ?
<sql:param value="${aa}" />
</sql:update>
-------------------------------------------------------------------------------------
<c:set var="SiteId" value="3"/>
<sql:update dataSource="${db}" var="count">
UPDATE websites SET name = 'RUNOOB' WHERE Id = ?
<sql:param value="${SiteId}" />
</sql:update>
--%>