on 2005 Jul 28 12:46 PM
Hi All,
I'm building a Java Application to connect to SAP. However I'm unable to connect with the JCo. I have checked and ensured that all libraries are in the required paths as per the installation & configuration
manual.I am also able to log in SAP using the SAP GUI.
This is the java code that I have written:
import com.sap.mw.jco.*;
public class Connection1 {
public static void main(String[] args) {
JCO.Client mConnection;
mConnection = JCO.createClient
("100", "****", "****", "EN", "10.191.126.68", "00");
try {
mConnection.connect();
}
catch (Exception ex)
{
ex.printStackTrace();
System.exit(1);
}
mConnection.disconnect();
}
}
The ERROR message i get is:
com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect
from SAP gateway to RFC server failed
Connect_PM GWHOST=10.191.126.68, GWSERV=sapgw00, ASHOST=10.191.126.68,
SYSNR=00
LOCATION SAP-Gateway on host iscprojapp1w / sapgw00
ERROR connection to host 10.191.126.68, service sapgw00 timed out
TIME Thu Jul 28 16:06:19 2005
RELEASE 620
COMPONENT NI (network interface)
VERSION 36
RC -12
MODULE nixxi.c
LINE 821
DETAIL NiPConnect
COUNTER 2
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeConnect(Native
Method)
at com.sap.mw.jco.rfc.MiddlewareRFC$Client.connect(Unknown
Source)
at com.sap.mw.jco.JCO$Client.connect(Unknown Source)
at Connection1.main(Connection1.java:18)
Hi Deepika,
Make sure that you have following entry in your <windows>/system32/drivers/etc/services file -
sapgw00 3300/tcp
If it is not there then add it.
Cheers,
Sanjeev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also depending on the JCO version
Especially if you use the latest ones
USERNAME should be in CAPITALS
PASSWORD should be in CAPITALS
Read different OSS notes. If you are connecting to an older system that does not support dual case in username and password make sure to pass them in uppercase.
There is a modification for older SAP systems (see OSS) but to me it is way easier to just pass username and password in uppercase. The older JCO versions used to do that for you.
The newer JCO destined to work as well with NW versions will make the distinction in case and this may prevent you from logging on to your R3 System...
You said you read up on pooled connections ==> for this you need a connection first....
Did you read up on load balanced connections ?
Did you read up on connections involving saprouters ?
Enjoy ...
Message was edited by: F.J. Brandelik
Can you start the sapgui from the dos prompt typing:
sapgui [connection parms] ?
If you can use the same connection parms for the JCO and add username + password and you should be ok.
Hi Sanjeev,
This is what I'vve added in my SAP GUI:
Application server: 10.191.126.68
System number: 00
And this what I have in my Java code:
mConnection = JCO.createClient("100", "********", "****", "EN", "10.191.126.68", "00");
I've also been able to get into SAP from the command prompt based on another suggestion..
Do you see anything incorrect in the parameters I've specified?
Thanks,
Deepika.
Message was edited by: Deepika Bhaskar
Hi All,
Firstly, thanks for all your helpful suggestions & answers.
I was able to succeed in connecting to SAP through the JCo. Well, I was using the IP address of the SAP system in the JCO.createClient().. Since even my error message was mapping the IP to the hostname I presumed that the IP must be getting resolved. While I was trying out various options I just tried replacing the IP in the JCO.createClient() method with the hostname and it worked!
Again, thank you all, for your time.
Deepika.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brandelik,
I looked up SM51 like you suggested. All parameters including the sysnr of the app server match with what I have specified in my java code.
Also, I did read up on the different ways to establish a connection.. especially about pool connections, but in all cases I would have to specify similar parameters again. More importantly my java program fails to connect when the SAP gateway attempts to connect to the
RFC server.
Deepika.
User | Count |
---|---|
66 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.