cancel
Showing results for 
Search instead for 
Did you mean: 

JCO Connectivity issue

Former Member
0 Kudos

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)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Sanjeev,

I checked the services file for the entry you mentioned and it's already there. IS there anything else that you would suggest I check..?

Thanks,

Deepika.

Former Member
0 Kudos

Hi Deepika,

Sorry I didn't notice earlier that you are able to connect to SAP using GUI. Can you post your SAPGUI connection parameters ? Since you are able to connect to SAP using GUI, all that you need in your java program is correct connection parameters.

Cheers,

Sanjeev

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Answers (1)

Answers (1)

guru_subramanianb
Active Contributor
0 Kudos

Hi Deepika,

Refer the following link which has answers to your queries.

I think this will solve ur problem.

Regards,

Guru

P.S :- Close this thread and reward points if you find the answer is satisfactory.

Former Member
0 Kudos

in SAP go to sm51 and check the parms running on the app server you are trying to connect to (especially the sysnr).

Read up on the different ways to establish a connection:

load balancing, through saprouter and so on...

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Guru,

Thanks for those links. I've gone through the thread(s) and most of it seems to be applicable to WAS. WAS is not installed on the SAP app server that I am conencting to. So i believe the creation of a 'GROUP' is not required..? Do correct me if I've got that wrong.

Thanks,

Deepika.