on 09-05-2005 1:47 PM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.