Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

PAR - Connection to Backend - could not connect

I have created a Portal Component and creating a connection for backend access to the R/3 system.

I am able to pass the User Context - user to logon to backend system.

But now I need to pass a different user & password other than the User Context from portal in Abstract Portal component project.

I have below code which is not working. Please help me if you find any problem or suggestions requested.

                                                IConnection mm_con = null;
						 //connection factory of the SAP connector to retrieve the connection from
						 IConnectionFactory connectionFactory=null;
						 Context initctx = null;

							 //obtain the initial JNDI context
							 Hashtable env = null;
							 initctx = new         com.sapportals.portal.prt.jndisupport.InitialContext(env);

							 // perform JNDI lookup to obtain connection factory
							 connectionFactory = (IConnectionFactory) initctx.lookup("deployedAdapters/SAPFactory/shareable/SAPFactory");

							 // retrieve the ConnectionSpec and set the values
							 IConnectionSpec spec = connectionFactory.getConnectionSpec();


							 spec.setPropertyValue("client", "500");
							 spec.setPropertyValue("user", "username");
							 spec.setPropertyValue("passwd", "password");
							 spec.setPropertyValue("lang", "EN");
							 spec.setPropertyValue("ashost", "development_r/3_server_url:port");
							 spec.setPropertyValue("sysnr", "00");

							 // Retrieve the connection handle
							 mm_con = connectionFactory.getConnectionEx(spec);


Former Member
Not what you were looking for? View more on this topic or Ask a question