Re: Oracle 10g with Tomcat 6
You are using an old syntax for defining resource parameters. Parameters of a resource are defined as attributes of the Resource / element since tomcat 5.5. See the following docs for the correct method: http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html --David Mohammed Zabin wrote: Hi All I want to conigure DBCP to connect to Oracle 10g on my localhost on Tomcat6. I did the following error, I don't know how to solve it, is there is a third-party jar file that must be added to classpath??? *1. I put the following in server.xml* *Resource name=jbdc/myoracledb auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/myoracledb parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@127.0.0.1:1521:orcldb/value /parameter parameter nameusername/name valuehr/value /parameter parameter namepassword/name valuehr/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams* *2. The following in web.xml:* *resource-ref descriptionOracle Datasource example/description res-ref-namejdbc/myoracledb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref* 3. And here is my JSP Code: %@ page import=javax.sql.*, javax.naming.*, java.sql.* % % Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb); Connection conn = ds.getConnection(); out.println( Connection Established ); % When running the page, i got the following error: *org.apache.jasper.JasperException: An exception occurred processing JSP page /jsp/testDBCP.jsp at line 7 4: Context initContext = new InitialContext(); 5: Context envContext = (Context)initContext.lookup(java:/comp/env); 6: DataSource ds = (DataSource)envContext.lookup(jdbc/myoracledb); 7: Connection conn = ds.getConnection(); 8: 9: out.println( Connection Established ); 10: % Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)* ** *root cause * *javax.servlet.ServletException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784) org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:73) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)* - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Oracle 10g with Tomcat 6
Mohammed, Maybe on import try the following: %@ page import=javax.naming.Context,javax.naming.InitialContext,javax.naming.NamingException,javax.sql.DataSource % even though what you have should cover it, theoretically. And regarding below, YES!!! C:\tomcat\common\lib\ojdbc14_g.jar - Hi All I want to conigure DBCP to connect to Oracle 10g on my localhost on Tomcat6. I did the following error, I don't know how to solve it, is there is a third-party jar file that must be added to classpath??? - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]