on 03-15-2012 6:43 PM
Hi Experts,
I'm trying to access my ORADB through web dynpro java and I can't figure out why I keep getting an exception ClassNotFoundException: oracle.jdbc.driver.OracleDriver. Here are the steps I took:
I downloaded the Oracle JDBC driver from the oracle site. I downloaded the 11g drivers. (On the oracle site it says its for Java 1.5 sdk, I'm running NWDS 7.0.26 which uses Java 1.4.2, don't know if this might be causing the issue?)
I created a local webdynpro project, as I just wanted to test the functionality.
In my component controller I created a method called callOracleStoredProcedure and wrote the following code:
import java.sql.*;
import oracle.jdbc.driver.OracleDriver;
public void callOracleStoredProcedure()
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver"); // This line fails
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver); // This line fails also.
// There is more code here but I cannot even get passed the above two lines
}
catch(Exception e)
{
wdComponentAPI.getMessageManager().reportException(""+e, true);
}
}
I alternate the usage of the above two lines, not using at the same time.
In my project I have added an external jar file to the java build path and the entry shows up in the classpath also. However, the weird thing is if I click on Project->repair, it removes the jar file entry! Why?
Can someone please shed some light for me? I know there are other threads which explore the possiblity of adding a datasource through Visual Admin configuration, but I want to try it this way first without going thru writing any actual SQL statements. The stored procedure im trying to call returns a ref cursor and I want to just make the call, retrieve the data and copy into my WDPJ context. But why can't I load the driver and why doesn't Web Dynpro find the class even though the jar and everything is there?? Totallly baffled!
Please HELP!
Paskal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jun,
I've also tried the 1.4 driver, but it doesnt load anyway and errors out at the same line of code and that driver is for oracle 10g, I'm on 11g and so using the newer driver. Actually I do know how to use an external lib but I don't need to create an external lib...this is a local web dynpro project not a development component. it should load the driver locally as long as the jar file is included in the project.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.