cancel
Showing results for 
Search instead for 
Did you mean: 

if I know IP address, how to set DestinationDataProvider.JCO_ASHOST

Former Member
0 Kudos

If I only set the ip address, for example 10.58.0.100, it will return an error

empty/10.58.0.100, but I don't know the ASHOST.

Can anybody help?

Lament

Accepted Solutions (1)

Accepted Solutions (1)

ravindra_bollapalli2
Active Contributor
0 Kudos

hi

could u explain your problem more clearly so that we can work out

bvr

Former Member
0 Kudos

Hi , here is the related code, I only know the remote server ip address 10.58.12.191 , system number and client, I did not know the SID.

import java.io.File;

import java.io.FileOutputStream;

import java.util.Properties;

import com.sap.conn.jco.JCoDestination;

import com.sap.conn.jco.JCoDestinationManager;

import com.sap.conn.jco.JCoException;

import com.sap.conn.jco.ext.DestinationDataProvider;

public class StepByStepClient {

static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";

static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";

static {

Properties connectProperties = new Properties();

connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST,

"SLM");

connectProperties.setProperty(DestinationDataProvider.JCO_DEST,

"10.58.12.191");

connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "01");

connectProperties

.setProperty(DestinationDataProvider.JCO_CLIENT, "600");

connectProperties.setProperty(DestinationDataProvider.JCO_USER,

"homo faber");

connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD,

"alaska");

connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");

createDestinationDataFile(DESTINATION_NAME1, connectProperties);

connectProperties.setProperty(

DestinationDataProvider.JCO_POOL_CAPACITY, "3");

connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,

"10");

createDestinationDataFile(DESTINATION_NAME2, connectProperties);

}

static void createDestinationDataFile(String destinationName,

Properties connectProperties) {

File destCfg = new File(destinationName + ".jcoDestination");

try {

FileOutputStream fos = new FileOutputStream(destCfg, false);

connectProperties.store(fos, "for tests only !");

fos.close();

} catch (Exception e) {

throw new RuntimeException(

"Unable to create the destination files", e);

}

}

public static void step1Connect() throws JCoException {

JCoDestination destination = JCoDestinationManager

.getDestination(DESTINATION_NAME1);

System.out.println("Attributes:");

System.out.println(destination.getAttributes());

System.out.println();

// destination = JCoDestinationManager.getDestination(DESTINATION_NAME2);

// System.out.println("Attributes:");

// System.out.println(destination.getAttributes());

// System.out.println();

}

public static void main(String[] args) throws JCoException {

step1Connect();

}

}

Following is the error message:

xception in thread "main" com.sap.conn.jco.JCoException: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed

Connection parameters: TYPE=A DEST=ABAP_AS_WITHOUT_POOL ASHOST=SLM SYSNR=01 PCS=1

LOCATION CPIC (TCP/IP) on local host with Unicode

ERROR hostname 'SLM' unknown

TIME Fri Dec 05 21:08:55 2008

RELEASE 711

COMPONENT NI (network interface)

VERSION 39

RC -2

MODULE ninti.c

LINE 895

DETAIL NiPGetHostByName: 'SLM' not found

SYSTEM CALL getaddrinfo

COUNTER 2

at com.sap.conn.jco.rt.MiddlewareJavaRfc.generateJCoException(MiddlewareJavaRfc.java:604)

at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.connect(MiddlewareJavaRfc.java:1270)

at com.sap.conn.jco.rt.ClientConnection.connect(ClientConnection.java:661)

at com.sap.conn.jco.rt.PoolingFactory.init(PoolingFactory.java:103)

at com.sap.conn.jco.rt.ConnectionManager.createFactory(ConnectionManager.java:171)

at com.sap.conn.jco.rt.DefaultConnectionManager.createFactory(DefaultConnectionManager.java:44)

at com.sap.conn.jco.rt.ConnectionManager.getFactory(ConnectionManager.java:160)

at com.sap.conn.jco.rt.RfcDestination.initialize(RfcDestination.java:766)

at com.sap.conn.jco.rt.RfcDestination.getAttributes(RfcDestination.java:618)

at com.sap.conn.jco.rt.RfcDestination.getAttributes(RfcDestination.java:26)

at StepByStepClient.step1Connect(StepByStepClient.java:52)

at StepByStepClient.main(StepByStepClient.java:62)

Caused by:

RfcException: [null]

achim_hauck2
Active Contributor
0 Kudos

gates,

you say you don't know the SID but you use SLM as ASHOST-parameter... I guess, SLM is your SID & use the ip-address in the ASHOST-parameter.

kr, achim

Former Member
0 Kudos

Hi Achim,

By setting the AS_HOST, now I can connect to the R/3 System.

Thanks very much.

Best regards,

Blake Le

Answers (0)