How using sql tags with a Oracle context

Discussions

Web tier: servlets, JSP, Web frameworks: How using sql tags with a Oracle context

  1. How using sql tags with a Oracle context (1 messages)

    I recently install Oracle10g and JakartaTomCat and i can run sql statemenst from my JSP page. In fact, i read many webpages examples with MySQL using only the sql tags, making more usefull.

    How can i make it whit Oracle? I need more configuration in server.xml, context.xml or web.xml?

    In web.xml i have this:
    <resource-ref>
            <description>Fuente de datos Oracle10g en servidor linkamarillo</description>
            <res-ref-name>jdbc/oracleInLinkamarillo</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>

    In $CATALINA_HOME/conf/server.xml:
    <Resource
                            name="jdbc/oracleInLinkamarillo"
                            auth="Container"
                            type="javax.sql.DataSource"
                            driverClassName="oracle.jdbc.driver.OracleDriver"
                            factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
                            url="jdbc:oracle:thin:@server:9999:SID"
                            username="xxx"
                            password="xxx"
                            maxActive="20"
                            maxIdle="10"
                            maxWait="-1"/>

    In $CATALINA_HOME/conf/context.xml:
    <ResourceLink global="jdbc/oracleInLinkamarillo" name="jdbc/oracleInLinkamarillo" type="javax.sql.DataSource"/>

    I using this code:
    <sql:query var="rs" dataSource="jdbc/oracleInLinkamarillo">
    select id, descripcion, vigencia, periodo from prm_validaciones
    </sql:query>

      <h2>Results con la etiqueta sql</h2>

    <c:forEach var="row" items="${rs.rows}">
        Clave Id: ${row.id}<br>
        Descripcion: ${row.descripcion}<br>
        Vigencia: ${row.vigencia}<br>
        Periodo: ${row.periodo}
    </c:forEach>

    ... and the result in screen is this:
    Clave Id: ${row.id}
    Descripcion: ${row.descripcion}
    Vigencia: ${row.vigencia}
    Periodo: ${row.periodo}

    How can i use sql tags with a Oracle context?

    thks.
  2. The JSTL SQL tags work just fine with Oracle see:
    http://www.oracle.com/technology/products/jdev/tips/schalk/jstl_sql/jstl_sql.html for example. You might try setting the datasource up directly in the page to make sure that that works - then move on to using a JNDI lookup.