cancel
Showing results for 
Search instead for 
Did you mean: 

JCO clientPool connection refused

Former Member
0 Kudos

Hello fellow JCO Programmers,

I am stuck with a problem concerning the clientPool facility of JCO.

Using the code below:


JCO.Pool clientPool = JCO.getClientPoolManager().getPool(CLIENT_POOL_NAME);
        if (null == clientPool) {
            JCO.addClientPool(CLIENT_POOL_NAME, 50, _name, _user, _password, _language, _host, _systemNumber);
        }
        client = JCO.getClient(CLIENT_POOL_NAME);

always gives me a "connection refused" error when executing "JCO.getClient".

Using a single connection like this


JCO.createClient(_name, _user, _password, _language, _host, _systemNumber);

works however.

Could that be a problem on the remote side, and the admin has to enable the SAP system for client pooling first?

Thanks for any help!

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Philipp,

Welcome to SDN. Try this code it works for me,

/**

  • Project :SAPJCOTutorial

  • Date :Sep 5, 2005

  • Programmed By: Kathirvel Balakrishnan

  • Company : Wipro Technologies

  • Designation : Project Engineer

*/

package com.MyJCoPrograms;

import java.util.Properties;

import com.sap.mw.jco.*;

/**

  • ConnectionPoolExample

*/

public class ConnectionPoolExample {

static final String myConnPool = "CONNPOOL";

public static void main(String[] args) {

JCO.Client myClient = null;

try{

JCO.Pool myPool = JCO.getClientPoolManager().getPool(myConnPool);

if(myPool==null){

// Setting the Properties for Connection

Properties myProperties = new Properties();

myProperties.setProperty("jco.client.client","client");

myProperties.setProperty("jco.client.user","user");

myProperties.setProperty("jco.client.passwd","password");

myProperties.setProperty("jco.client.ashost","serverip");

myProperties.setProperty("jco.client.sysnr","systemnum");

JCO.addClientPool(myConnPool,5,myProperties);

myClient = JCO.getClient(myConnPool);

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

}

}catch(Exception E1){

System.out.println(E1.toString());

}

}

}

As you are new to SDN please have a look at the Points system for rewarding points to the helpful asnswers.

https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm

Thanks and Regards,

Kathirvel

Former Member
0 Kudos

If you are using JCO 2.1.5 make sure to pass all information in UPPER CASE where needed. From this version on the JCO is case sensitive. Check out sapnotes...

Enjoy

Former Member
0 Kudos

Looks like my original code is working already but not inside a thread. When I call the code from the main tread a client can be created in the pool and as direct connection. If I try to create a client inside another thread it does not work

I will check the UPPER CASE however.