Thank you Foo for your patience with me,
I did imported all the needed classes, but i got the following exception:


*exception *

*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( "The Connection Gotted Fine" );
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)*

**

*root cause*

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'
        
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:780)
        
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
        org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:62)
        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)

*root cause*

java.lang.NullPointerException
        sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
        sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
        sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
        java.sql.DriverManager.getDriver(DriverManager.java:253)
        
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773)
        
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
        org.apache.jsp.jsp.testDBCP_jsp._jspService(testDBCP_jsp.java:62)
        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)




On 5/22/07, Foo Shyn <[EMAIL PROTECTED]> wrote:

The jsp doesn't import the class for Context and Initial Context. Put
them in as how u inport the Datasource would do.

HTH
FooShyn

Mohammed Zabin wrote:
> Thank you Foo,
> I but the following in the context.xml:
>
> *<Resource name="Name"
>         auth="Container"
>         type="oracle.jdbc.pool.OracleDataSource"
>         factory="oracle.jdbc.pool.OracleDataSourceFactory"
>         user="hr"
>         password="hr"
>         driverClassName="oracle.jdbc.driver.OracleDriver"
>         url="jdbc:oracle:thin:@localhost:1521:orcldb"
>         maxActive="20" maxIdle="10" maxwait="-1"/>*
> **
> and I have this jsp code:
>
>
> *<%@ page import="javax.sql.DataSource" %>*
>
> *<%
>  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( "Got the connection" );
> %>*
>
> but, i got the following error:
>
> *org.apache.jasper.JasperException: Unable to compile class for JSP:
>
> An error occurred at line: 4 in the jsp file: /jsp/testDBCP.jsp
> Context cannot be resolved to a type
> 1: <%@ page import="javax.sql.DataSource" %>
> 2:
> 3: <%
> 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();
>
>
> An error occurred at line: 4 in the jsp file: /jsp/testDBCP.jsp
> InitialContext cannot be resolved to a type
> 1: <%@ page import="javax.sql.DataSource" %>
> *
>
> On 5/22/07, Foo Shyn <[EMAIL PROTECTED]> wrote:
>>
>> Not both of them. It's context.xml if u're using Tomcat 5.0 or above,
or
>> server.xml if u're using Tomcat 4.1 or below, which is located in the
>> conf folder in Tomcat root path.
>>
>> check this link out :
>> http://forums.oracle.com/forums/thread.jspa?messageID=1489914
>>
>> Hope that helps.
>> FooShyn
>>
>> Mohammed Zabin wrote:
>> > Thank you buddy, I have another confusing question for me,
>> > I have two web.xml files, one in conf/web.xml and one in my
>> application
>> > under WEB-INF,
>> > When configuring connection pool, which one shall i use? or shall i
>> > put the
>> > configuration parameters in both of them??
>> >
>> > Thank you
>> >
>> >
>> > On 5/22/07, ben short <[EMAIL PROTECTED]> wrote:
>> >>
>> >> Have a look here..
>> >>
>> >>
>> >>
>>
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
>>
>> >>
>> >>
>> >> On 5/22/07, Mohammed Zabin <[EMAIL PROTECTED]> wrote:
>> >> > Hi All
>> >> >
>> >> > Am new on this, i want to know how to configure Database
Connection
>> >> Pooling
>> >> > to use Oracle Database?? anyhelp will be appreciated.
>> >> >
>> >> > Jotnarta
>> >> >
>> >>
>> >>
---------------------------------------------------------------------
>> >> To start a new topic, e-mail: users@tomcat.apache.org
>> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >> For additional commands, e-mail: [EMAIL PROTECTED]
>> >>
>> >>
>> >
>> >
>>
------------------------------------------------------------------------
>> >
>> > No virus found in this incoming message.
>> > Checked by AVG Free Edition.
>> > Version: 7.5.467 / Virus Database: 269.7.6/814 - Release Date:
>> 5/21/2007
>> 2:01 PM
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.467 / Virus Database: 269.7.6/814 - Release Date: 5/21/2007
2:01 PM
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to