Home » Developer & Programmer » JDeveloper, Java & XML » see my jsp error dscon$jsp.java [67:1] cannot resolve symbol (not configer tomcate datasource)
see my jsp error dscon$jsp.java [67:1] cannot resolve symbol (not configer tomcate datasource) [message #216141] Thu, 25 January 2007 04:47
mfa786
Messages: 210
Registered: February 2006
Location: karachi
Senior Member
sir i want to use the datasource in my jsp page
i see tomcate help in connection pooling

then i set my server.xml and web.xml

server.xml
location = C:\Program Files\j2sdk_nb\netbeans3.5\tomcat406\conf\server.xml
code ==***
***********
- <Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_DBTest_log." suffix=".txt" timestamp="true" />
<Resource name="jdbc/myoracle" auth="Container" type="javax.sql.DataSource" />
- <ResourceParams name="jdbc/myoracle">
- <parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
- <parameter>
<name>driverClassName</name>
<value>oracle.jdbc.OracleDriver</value>
</parameter>
- <parameter>
<name>url</name>
<value>jdbc:oracle:thin:@127.0.0.1:1521:aamir</value>
</parameter>
- <parameter>
<name>username</name>
<value>scott</value>
</parameter>
- <parameter>
<name>password</name>
<value>tiger</value>
</parameter>
- <parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
- <parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
- <parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
</Context>

*******

web.xml

where my all file and my project

location = F:\oraclewithjavaconn\WEB-INF\web.xml

code ==***
***********

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE web-app (View Source for full doctype...)>
- <resource-ref>
<description>Oracle Datasource example</description>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

******

sir this is my jsp code for database instance in
F:\oraclewithjavaconn\conntest
*******

<HTML>
<%@ page import="java.sql.*,java.util.*" %>
<%
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();
%>
<br>
TEST DONE!
</HTML>
*************

sir when i compli the page then system give me error

error*********

scon$jsp.java [67:1] cannot resolve symbol
symbol : class Context
location: class org.apache.jsp.dscon$jsp
Context initContext = new InitialContext();
^
dscon$jsp.java [67:1] cannot resolve symbol
symbol : class InitialContext
location: class org.apache.jsp.dscon$jsp
Context initContext = new InitialContext();
^
dscon$jsp.java [68:1] cannot resolve symbol
symbol : class Context
location: class org.apache.jsp.dscon$jsp
Context envContext = (Context)initContext.lookup("java:/comp/env");
^
dscon$jsp.java [68:1] cannot resolve symbol
symbol : class Context
location: class org.apache.jsp.dscon$jsp
Context envContext = (Context)initContext.lookup("java:/comp/env");
^
dscon$jsp.java [69:1] cannot resolve symbol
symbol : class DataSource
location: class org.apache.jsp.dscon$jsp
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
^
dscon$jsp.java [69:1] cannot resolve symbol
symbol : class DataSource
location: class org.apache.jsp.dscon$jsp
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
^
6 errors
Errors compiling dscon.
************

sir please give me idea how i use datasource in my jsp page

thank

aamir
Previous Topic: Error OracleResultSet getString + constraint expression
Next Topic: dbms_xmlgen / Clob search and replace?
Goto Forum:
  


Current Time: Sun Nov 24 13:31:01 CST 2024