cancel
Showing results for 
Search instead for 
Did you mean: 

Authorization Error using JDBC Lookup while writing the UDF.

former_member644654
Participant
0 Kudos

Hi All,

Please help me resolve this error while using a JDBC Lookup while writing a UDF for it. It is giving an authorization error. while trying to Display Queue on the UDF written.

The code is like:

DataBaseAccessor accessor = null;

DataBaseResult JDBCOutPayload = null;

String BusinessSystem="clarify_dev_bizsys";

//give your business system having channel name

String CommunicationChannel="JDBC_TO_CDEV";

//give your channel name

String InputPayload= " select X_TXN_PRE_SITE_XFACE.nextval from dual;";

//give your sql query

try {

Channel channel =

LookupService.getChannel(BusinessSystem,CommunicationChannel);

accessor = LookupService.getDataBaseAccessor(channel);

DataBaseResult resultSet = accessor.execute(InputPayload);

for(Iterator rows = resultSet.getRows();rows.hasNext();)

{

Map rowMap = (Map)rows.next();

}

}

catch (Exception e) {}

finally {

if (accessor != null)

accessor.close();

}

OBJID.addValue("OBJID");

The errors are "User has no Authorization". and "/usr/sap/XIX/DVEBMGS03/j2ee/cluster/server0/./temp/classpath_resolver/Map4fdb99c0b3c311de8ec7001560de7906/source/com/sap/xi/tf/_MM_CLARIFY_MODELS_.java:139: unreported exception com.sap.aii.mapping.lookup.LookupException; must be caught or declared to be thrown accessor.close();"

I've imported both com.sap.aii.mapping.lookup.;java.util.;

Is there any parameter where we can give the User ID & Password for accessing the database table which I've missed. As I've already given the USERID & Password in the Communication Channel.

Thanks in Advance,

Sreedhar.

Edited by: Sreedhar Av on Oct 8, 2009 6:29 AM

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member644654
Participant
0 Kudos

Opened a new thread for it.

former_member187339
Active Contributor
0 Kudos

Hi,

Refer this blog:

http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417800%29ID0216641450DB0079090422750902016...

I think you need some optimization of your code

Regards

suraj

Former Member
0 Kudos

accessor.close();

this method has to be written in a try block because it throws an LookUpException and catch the exception in catch block then you dont get the error

former_member644654
Participant
0 Kudos

Hi,

I've modified my code like this

DataBaseAccessor accessor = null;

DataBaseResult JDBCOutPayload = null;

String BusinessSystem="clarify_dev_bizsys";

//give your business system having channel name

String CommunicationChannel="JDBC_TO_CDEV";

//give your channel name

String InputPayload= " SELECT X_TXN_PRE_SITE_XFACE.nextval from dual;";

//give your sql query

try {

Channel channel = LookupService.getChannel("BusinessSystem","CommunicationChannel");

accessor = LookupService.getDataBaseAccessor(channel);

DataBaseResult resultSet = accessor.execute(InputPayload);

for(Iterator rows = resultSet.getRows();rows.hasNext();)

{

Map rowMap = (Map)rows.next();

}

OBJID.addValue("OBJID");

}

catch (Exception e) {}

result.addValue(e.getMessage()) ;

finally {

try{

if (accessor != null) accessor.close();

}

catch(Exception e)

{

OBJID.addValue(e.getMessage()) ;

}

Correct me if I'm wrong anywhere.

Now it is giving an error:

"/usr/sap/XIX/DVEBMGS03/j2ee/cluster/server0/./temp/classpath_resolver/Map3fb95c30b3d211de98da001560de7906/source/com/sap/xi/tf/_MM_CLARIFY_MODELS_.java:138: 'finally' without 'try' finally {"

Thanks in Advance.

Sreedhar.

Edited by: Sreedhar Av on Oct 8, 2009 8:15 AM

former_member644654
Participant
0 Kudos

Hi,

I've changed the USERID & Password, authorization error is resolved but now it is giving the error:

usr/sap/XIX/DVEBMGS03/j2ee/cluster/server0/./temp/classpath_resolver/Mapcab44fb0b3c411deb8c0001560de7906/source/com/sap/xi/tf/_MM_CLARIFY_MODELS_.java:138: unreported exception com.sap.aii.mapping.lookup.LookupException; must be caught or declared to be thrown accessor.close();

How do rectify this?

Sreedhar.

rajasekhar_reddy14
Active Contributor
0 Kudos

You dont have authorization to access the data from DATA BASE,You mention use name password in communication channel,but the user doesnot have acces permission.

former_member644654
Participant
0 Kudos

Hi Raja,

I've changed the USERID & Password but now it is giving the error:

usr/sap/XIX/DVEBMGS03/j2ee/cluster/server0/./temp/classpath_resolver/Mapcab44fb0b3c411deb8c0001560de7906/source/com/sap/xi/tf/_MM_CLARIFY_MODELS_.java:138: unreported exception com.sap.aii.mapping.lookup.LookupException; must be caught or declared to be thrown accessor.close();

How do rectify this?

Sreedhar.