Just add this to the
Copy Code code as follows:
<context docbase= "C:/Program files/apache Software Foundation/tomcat5.5/webapps/fengyue" "Path=" "0" Reloadable= "true" privileged= "true" >
<resource name= "aaa/oracleds" type= "Javax.sql.DataSource"
Password= "maxtie17061706"
Driverclassname= "Oracle.jdbc.driver.OracleDriver"
Maxidle= "2"
maxwait= "5000"
Username= "Maxtie"
Url= "Jdbc:oracle:thin:@192.168.0.13:1521:mmis"
Maxactive= "4"/>
</Context>
This is the default project plus connection pool configured, if you want to not as the default project, just change path on the AH
If you only match the default project:
Copy Code code as follows:
<context docbase= "C:/Program files/apache Software Foundation/tomcat5.5/webapps/fengyue" "Path=" "0" Reloadable= "true" privileged= "true" ></Context>
The key is this path.
Finally, the test code must be run in the Web project.
Copy Code code as follows:
InitialContext CTX = new InitialContext ();
DataSource ds = (DataSource) ctx.lookup ("Java:comp/env/aaa/oracleds");
conn = Ds.getconnection ();