Hi

I'm about to make an upgrade of my old Oracle 8 jsp server to a tomcat
server and would like to connect to the database using JNDI.

Normaly I would do something like this:

DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:SERVER","u
sr","pass");

Now I have set up the JNDI in tomcat and get the connection like this:

Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();

Everything works fine, except when I uses Oracle
(oracle.jdbc.driver.OracleDriver) specific functions like this:

// CallableStatement cstmt
rs = cstmt.getCursor(1);

I figure out that what I worked with wasn't oracles classes, but a
regular JDBC classes (java.sql). I also tried this:

rs = ((OracleCallableStatement) cstmt).getCursor(1);


Does anyone have an Idea how to fix this?



Think this is the rows in server.xml. (Used the admin interface to set
it up)


          <Resource auth="Container" description="DB Connection"
name="jdbc/DEVELOP" scope="Shareable" type="javax.sql.DataSource"/>
          <Resource auth="Container" name="jdbc/myoracle"
scope="Shareable" type="javax.sql.DataSource"/>
          <Resource auth="Container" description="DB Connection"
name="DEVELOP" scope="Shareable" type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/myoracle">
            <parameter>
              <name>url</name>
              <value>jdbc:oracle:thin:@127.0.0.1:1521:ORCL</value>
            </parameter>
            <parameter>
              <name>validationQuery</name>
              <value>select count(*) from usr.table</value>
            </parameter>
            <parameter>
              <name>maxIdle</name>
              <value>10</value>
            </parameter>
            <parameter>
              <name>maxActive</name>
              <value>20</value>
            </parameter>
            <parameter>
              <name>driverClassName</name>
              <value>oracle.jdbc.driver.OracleDriver</value>
            </parameter>
            <parameter>
              <name>maxWait</name>
              <value>-1</value>
            </parameter>
            <parameter>
              <name>username</name>
              <value>usr</value>
            </parameter>
            <parameter>
              <name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value>pwd</value>
            </parameter>
          </ResourceParams>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to