Configure Root.xml file:
<Context
docBase="%docBase%"
path=""
reloadable="true"
debug="1"
>
<Context
docBase="%docBase%"
path=""
reloadable="true"
debug="1"
>
<Resource
auth="Container"
description="Oracle Datasource"
name="jdbc/mydb"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
maxIdle="4"
maxWait="-1"
maxActive="8"
removeAbandoned="true"
logAbandoned="true"
url="%db_url%"
connectionProperties="oracle.jdbc.mapDateToTimestamp=false;"
username="%username%"
password="%password%" />
....
Use <sql:query>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<sql:setDataSource var="mydb" dataSource="jdbc/mydb"/>
<sql:query var="qry1" dataSource="${mydb}">
SELECT NAME FROM USER
WHERE USER_ID = ?
<sql:param>${uid}</sql:param>
</sql:query>
in the html:
<th>
${qry1.NAME}:
</th>
Comments
Post a Comment