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