Hi

I have the classes12.jar in lib. Think it was something with the JNDI
setup. Anyway. Got the tips about cstmt.getObject(1) from a forum also,
and it works fine!

Thanks for your help
Jan

> -----Ursprungligt meddelande-----
> Från: A mailing list about Java Server Pages specification 
> and reference [mailto:[EMAIL PROTECTED] För Ashish Agnihotri
> Skickat: den 27 januari 2004 10:16
> Till: [EMAIL PROTECTED]
> Ämne: Re: Oracle + JNDI problem
> 
> 
> Hi,
> 
> I don't think I got the helm of your problem but if you could 
> give me the stack-trace/error message of the exception being 
> thrown, I will be able to have a better insight. 
> 
> By the time try these -
> If its an NoSuchMethodException on getCursor() call, check if 
> the correct classes are present in the library path of your 
> server (NOTE: Tomcat understands ony the .jar files as the 
> libraries - so if you have a class12.zip file in the library 
> - renaming it to classes12.jar is the first thing you would 
> want to do).
> 
> If the problem still persists - you may also try using 
> "cstmt.getObject(1)" and then typecasting it to ResultSet later.
> 
> See if this works.
> 
> Regards
> - Ashish
> 
> -----Original Message-----
> From: Jan Arenö [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 27, 2004 1:59 PM
> To: [EMAIL PROTECTED]
> Subject: Oracle + JNDI problem
> 
> 
> 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


MASTEK
"Making a valuable difference"
Mastek in NASSCOM's 'India Top 20' Software Service Exporters List. In
the US, we're called MAJESCO

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not
that of Mastek Limited, unless specifically indicated to that effect.
Mastek Limited does not accept any responsibility or liability for it.
This e-mail and attachments (if any) transmitted with it are
confidential and/or privileged and solely for the use of the intended
person or entity to which it is addressed. Any review, re-transmission,
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. This e-mail and its attachments have been
scanned for the presence of computer viruses. It is the responsibility
of the recipient to run the virus check on e-mails and attachments
before opening them. If you have received this e-mail in error, kindly
delete this e-mail from all computers.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

========================================================================
===
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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 2004-01-27
 

===========================================================================
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