You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Manso Gomez, Ramon" <rm...@indra.es> on 2002/10/14 08:51:56 UTC

help conection a pool class (JDBC) and JSTL page.

 
 
I just buy JST book and I do not find any example that how to do this. I need to use a pool 
connection and I have :
 
IN WEB.XML
 
<context-param>
<param-name>AppListener</param-name>
<param-value>ds</param-value>
</context-param>
 
THE class is put undex WEB-INF/class and is:
 
mport javax.servlet.jsp.jstl.core.Config;
import javax.servlet.*;
import javax.servlet.http.*;
import oracle.jdbc.pool.*;
 
public abstract class AppListener implements ServletContextListener {
 
private OracleConnectionCacheImpl ds =null;
 
public void contextInitialized(ServletContextEvent sce){
  ServletContext application =sce.getServletContext();
  try {
 ds = new OracleConnectionCacheImpl();
 ds.setURL("jdbc:oracle:thin:@172.30.1.62:1521:CAM");
 ds.setMaxLimit(20);
 ds.setUser("DEMO");
 ds.setPassword("DEMO");
  }
  catch (Exception e){
 application.log("Failed to create data source:"+
 e.getMessage());
 
AND jsp:
 
<sql:transaction dataSource>
 
  <sql:update var="newTable">
    create table mytable (
      nameid number(10) primary key,
      name varchar2(80)
    )
  </sql:update>
.
.
 
But it is not working. I can not connect the class with datasource of jps page.
 
 
 
       }
  Config.set(application,Config.SQL_DATA_SOURCE, ds);              }
 
}
 

and give this error:
 
org.apache.jasper.JasperException
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain
 
Please, help.