我用的是tomcat5.0.28+oralce8.1.0.6+windows2000
server.xml:
   <ResourceParams name="jdbc/oa">
      <parameter>
        <name>url</name>
        <value>jdbc:oracle:thin:@10.25.140.228:1521:dbname</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>oa</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>4</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>oracle.jdbc.driver.OracleDriver</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>oa</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
    </ResourceParams>
web.xml:
   <description>DB Connection</description> 
<res-ref-name>jdbc/oa</res-ref-name> 
<res-type>javax.sql.DataSource</res-type> 
<res-auth>Container</res-auth> 
</resource-ref>
应用程序目录下的post.xml
<ResourceLink global="jdbc/oa" name="jdbc/oa" type="javax.sql.DataSourcer"/>该加的我觉着都加上了,可就是不行,请高手指教?

解决方案 »

  1.   

    对照这里仔细看看
    http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html0. Introduction
    We would appreciate comments on this section as I'm not an Oracle DBA :-)Oracle requires minimal changes from the MySQL configuration except for the usual gotchas :-) Firstly by default, Tomcat will only use *.jar files installed in $CATALINA_HOME/common/lib therefore classes111.zip or classes12.zip will need to be renamed with a .jar extension. Since jarfiles are zipfiles, there is no need to unzip and jar these files - a simple rename will suffice. Also, you should be aware that some (early) versions of Tomcat 4.0 when used with JDK 1.4 will not load classes12.zip unless you unzip the file, remove the javax.sql.* class heirarchy and rejar.1. server.xml configuration
    In a similar manner to the mysql config above, you will need to define your Datasource in your server.xml file. Here we define a Datasource called myoracle using the thin driver to connect as user scott, password tiger to the schema called myschema in the sid called mysid. (Note: with the thin driver this sid is not the same as the tnsname)Use of the OCI driver should simply involve a changing thin to oci in the URL string.    
     <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.driver.OracleDriver</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:oracle:thin:[email protected]:1521:mysid</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>  
       
    2. web.xml configuration
    You should ensure that you respect the elemeent ordering defined by the DTD when you create you applications web.xml file.   
     <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
     
      

  2.   


    你的oracle驱动包加载了没有