on 02-09-2005 4:01 AM
In a section of help.sap.com entitled
"Using Resource Adapter to Obtain a Connection"
the object ConnectionSpecImpl is instantiated. Does anyone know the package that contains such an sap object?
thank you.
Brad
Hi Brad,
This is an inner class of the com.sap.mw.jco.jra.JRA class that is part of SAP Java Resource Adapter (sapjra.jar).
Hope this helps,
Vladimir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks Vladimir,
However I am confused about something.
The example in the article referenced above shows a direct instantiation of the ConnectionSpecImpl object in order to pass R3 relevant connection properties to a javax.resource.cci.ConnectionFactory object. Makes sense, however accoring to sapjra.jar the ConnectionSpecImpl is deprecated and therefore you should not instantiate it.
I am using Netweaver '04 coding a bean to access the SAPFactory jndi object - ie the SAP ManagedConnectorFactory of the J2ee connector service.
First off I had to use as the JNDI lookup string:
"deployedAdapters/SAPFactory/shareable/SAPFactory"
to retreive the object of type
javax.resource.cci.ConnectionFactory from the connector service.
At this point I seem to require a ConnectionSpecImpl object (or something similar) to pass to the getConnection method of the connectionfactory in order to retrive the connection object.
So my question is: do you know how I can pass a suitable object to the getConnection(ConnectionSpec properties)
method of the ConnectionFactory object?
Or am I dong this in the wrong way?
Thanks,
Brad
Hi Brad,
If you are accessing the connection factory from an EJB, it's better to declare a resource reference from that EJB to the connection factory. Then you could specify a Container authentication and simply use the method getConnection() without parameters to obtain the Connection object. For more information on how to create and use a resource reference please have a look at
http://help.sap.com/saphelp_nw04/helpdata/en/64/8590109a86f145958fb22dab86d58d/frameset.htm
In the bean code you must use the string "java:comp/env/<res-ref-name>" to retrieve the ConnectionFactory object.
Hope it helps,
Vladimir
Hi Vladimir, this is indeed what I am trying to accomplish.
Here is my resource ref in my ejb:
<resource-ref> <res-ref-name>deployedAdapters/SAPFactory/shareable/SAPFactory</res-ref-name>
<res-type>javax.resource.cci.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
the res-ref-name from above comes from the PDF:
"JCA on EP6 : Building Portal Applications with Remote Function Modules" - March 2004 which states:
Another
approach (ie instead of the portal gateway service) is to obtain the initial JNDI/Java Naming and Directory Interface context.
// Obtain the initial JNDI context
// Context ctx = new InitialContext();
// Perform JNDI lookup to obtain connection factory
// Note: from SP3, the JNDI lookup string is
// deployedAdapters/SAPFactory/shareable/SAPFactory
// IConnectionFactory connectionFactory
// = (IConnectionFactory) ctx.lookup("EISConnections/SAPFactory");
// IConnectionSpec spec = connectionFactory.getConnectionSpec();
I am using the connection string as indicated above in place of "EISConnections/SAPFactory" however the object I get back from the lookup call is of type javax.resource.cci.ConnectionFactory
vs the desired IConnectionFactory sap object (as in the example).
The following is how I check the object type:
InitialContext ic = new InitialContext();
Object o = ic.lookup("deployedAdapters/SAPFactory/shareable/SAPFactory");
if(o instanceof ConnectionFactory)
{
//continue with code...
I tried various other objects in this instanceof statement (IConnectionFactory for example) but with no success.
so after the lookup:
ConnectionFactory cf = (ConnectionFactory) o; SAPCFConnectorConnectionSpec spec = new SAPCFConnectorConnectionSpec();
spec.put("client", "100");
spec.put("UserName", "xxxxxx");
spec.put("Password", "xxxxx");
spec.put("logonmethod", "UIDPW");
spec.put("Language", "EN");
spec.put("ashost", "xxxxxxx");
spec.put("sysnr", "00");
spec.put("SystemType", "SAP_R3");
spec.put("SystemName", "xxx");
try
{
Connection client = (Connection)cf.getConnection();
//continue
This code does return a connection object but I feel this method is not correct.
Do my problems begin with jndi? Should the return from the lookup be of type IConnectionFactory? Should the Connection I do obtain in my own code work against R3?
Thanks for any further input you may have.
Brad.
too bad Bradley Manning did not share his info with us.
i have to admit that my Question is more fundumental.
I am trying to add the SAPJRA.RAR file to the EISConnector, but can not obtain the SAPJRA.jar file.
can anyone point me to a location where it can be downloaded from, or send it to me (zach@checkpoint.com) ?
thank you
Sorry, I have not checked this thread in a while.
For connectivity to the SAPFactory I wrote:
connectionFactory = (IConnectionFactory) initctx.lookup("deployedAdapters/SAPFactory/shareable/SAPFactory");
IConnectionSpec spec = connectionFactory.getConnectionSpec();
spec.setPropertyValue("client", "100");
spec.setPropertyValue("user", "XXXXXX"); //uppercaps
spec.setPropertyValue("passwd", "xxxxxx");
spec.setPropertyValue("lang", "EN");
spec.setPropertyValue("SystemType", "SAP_R3");
//I beleive it needs to be typed exact as SystemType
spec.setPropertyValue("ashost", "xxxxxxxx");
spec.setPropertyValue("sysnr", "00");
//note Ex below
mm_con = connectionFactory.getConnectionEx(spec);
IInteraction iint = mm_con.createInteractionEx();
RecordFactory rf = iint.getRecordFactory();
MappedRecord inputs = rf.createMappedRecord("inputs");
inputs.put("UNAME", userid);
inputs.put("LETTER_LG", "E");
IInteractionSpec ixspec = iint.getInteractionSpec();
ixspec.setPropertyValue("Name", "ZBAPI...");
MappedRecord output = (MappedRecord)iint.execute(ixspec, inputs);
.
.
.
For connectivity to the SAPJRA I wrote:
connectionFactory = (ConnectionFactory) initctx.lookup("deployedAdapters/eis/SAPJRAFactory/shareable/eis/SAPJRAFactory");
mm_con = connectionFactory.getConnection();
Interaction inter = mm_con.createInteraction();
MappedRecord inputs = connectionFactory.getRecordFactory().createMappedRecord("ZBAPI...");
inputs.put("UNAME", userid);
inputs.put("LETTER_LG", "EN");
MappedRecord output = (MappedRecord)inter.execute(null, inputs);
.
.
.
The SAPJRA should be deployed using the deploy tool.
Some advice from another thread for using Deploy Tool:
You must create a new project, then go to the Deployment tab of the tool and load the rar using the Deploy->EAR->Load Module menu.
You will have to enter initial values for the properties of the ManagedConnectionFactory.
After you confirm that you want the application started, you will have the JRA ready to be used in your system.
The SAPJRA.jar is embedded within the rar...
Hope this helps.
Brad
Message was edited by: Bradley Manning
Message was edited by: Bradley Manning
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
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.