cancel
Showing results for 
Search instead for 
Did you mean: 

PAR - Connection to Backend - could not connect

kiran_jakkaraju
Contributor
0 Kudos

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);

							 mm_con.close();

Accepted Solutions (0)

Answers (1)

Answers (1)

kiran_jakkaraju
Contributor
0 Kudos

I got the answer