on 02-23-2005 3:42 AM
Dear all:
I have created a Oracle JDBC Connector (using J2EE Visual
admin). Its Application name is "sap.com/JDBCConnector_xi.xml" and its name is
"xi"
In my servlet I have the following code
"
ic = new InitialContext() ;
DataSource ds = (DataSource) ic.lookup
("jdbc/ourLookup");
"
During deployment (J2EE Components and Assembler
tab) I have entered the following:
Resource Name = jdbc/ourLookup
Resource Type = javax.sql.DataSource
Authorization Type = Application
Resource Sharing = Shareable
In the deployer tab (after connecting to the J2EE
Engine) in the Environment tab/Resource References I
given the following:
Resource Name = jdbc/ourLookup
Resource Type = javax.sql.DataSource
Authorization Type = Application
Resource Sharing = Shareable
Resource Link = xi
After clicking on "Make All" I have found that
web.xml and web-j2ee-engine.xml are created
and they have the following entries in them:
web.xml
-
<resource-ref>
<res-ref-name>alias1</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
web-j2ee-engine.xml
-
<resource-ref>
<res-ref-name>alias1</res-ref-name>
<res-link>xi</res-link>
</resource-ref>
But when the application runs I get a Persistent error
that NameNotFound Exception.
I would request any help from you. My email id is
caesar.dutta@in.pwc.com or caesardutta@yahoo.com
Thanks very much in advance.
Regards,
Caesar
Hi Ceasar,
as you have declared a resource reference to the DataSource and you are looking it up from a servlet, you have to perform the lookup relative to the java:comp/env context. That is, you should use
DataSource ds = (DataSource) ic.lookup
("java:comp/env/jdbc/ourLookup");
See also an example of looking up a DataSource for the default DataSource on the J2EE Engine: http://help.sap.com/saphelp_nw04/helpdata/en/7d/26e96f1d754408bfd658b6614cb1b6/frameset.htm
Hope that helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.