Skip to Content
0
Former Member
Nov 14, 2006 at 06:29 AM

JCO programing + problem in pool connection

16 Views

Hi all,

We are getting problem in pool connection I.e,

every time when we run servelt with jco, we need to change the pool name,

since servlet is a server related program we can not sit and do that in the server place manually,

below is the code what we have implemented...........

public class ServletwithSap extends HttpServlet {

<b>static final String Name2 = "Q4";</b>

protected void processRequest(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

String item = request.getParameter("item");

PrintWriter out = response.getWriter();

JCO.Pool Poolcool2 = JCO.getClientPoolManager().getPool(Name2);

JCO.Client mconnection;

IRepository repository;

JCO.Table codes = null;

if(Poolcool2 == null)

{

JCO.addClientPool(Name2,15,"100","cbruser", "cbruser","EN","*****","00");

mconnection = JCO.getClient(Name2);

repository = JCO.createRepository("myRepository",Name2);

try

{

IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZTEST1");

if(ftemplate == null)

{

}

JCO.Function function = ftemplate.getFunction();

function.writeHTML("C://function.html");

mconnection.execute(function);

codes = function.getTableParameterList().getTable("ITAB");

for (int i = 0; i < codes.getNumRows(); i++)

{

codes.setRow(i);

if(codes.getString("NAME").equals(item))

{

out.println(codes.getString("NAME"));

out.println(codes.getString("PLOTNUM"));

out.println(codes.getString("STATE"));

out.println(codes.getString("CITY"));

out.println(codes.getString("CODE"));

out.println(codes.getString("COUNTRY"));

}

}

}

catch(Exception ex)

{

out.println(ex.toString());

}

finally{

JCO.releaseClient(mconnection);

}

}

else

{

out.println("not attended if function");

}

}

Help me out in this Problem.........

Thanking you

Preethi