cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT mapping calls Java class, with hardcoded values-problem at Transport

mona_mehta
Participant
0 Kudos

Hi All,

I know the subject may be misguiding, but i need some suggestions how to handle the following scenario.

From my XSLT mapping, i am calling a java function which performs a data connection to an oracle database and then returns some values, whcih i have mapped in the mapping.

The problem is, i have hardcoded the Connection parameters....

and now that we transport these objects to production, the connection parameters will change.

I thought of two solutions

1) i create a new java class for Production system

2) i define the parameters as input arguemnts to my method, whcih is called from XSLT mapping

But in both cases, if theres any chg in future, there will a dependancy on one of the objects to be changed and sent again.

What is the suggested way? is there nothing like a property file(like in EP), where you define dependant parameters...and the file is only changed.

XI Gurus, please suggest me the correct way to handle.....

Thanks a lot.

Mona

Accepted Solutions (0)

Answers (2)

Answers (2)

bhavesh_kantilal
Active Contributor
0 Kudos

Mona,

This is exactly why you should use the JDBC LookUp Concept as disccused in this blog,

/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler

Create a Business Service and a Receiver JDBC adapter and this remain the same as you tranport it across environments. You can change the connection parametrers in the Comm Channel without touching your Look Up code.

Regards

Bhavesh

mona_mehta
Participant
0 Kudos

Thanks Bhavesh...i had seen this blog earlier...

I have a confusion here...

I have setup a Comm channel for the Oracle database as the reciever in my scenario already.

Since i have to lookup the same DB....Is it possible to use the same Comm. channel?

Please advice.

Regards,

Mona

bhavesh_kantilal
Active Contributor
0 Kudos

Mona,

No. You need to have a receiver adapter that is not involved in any Receiver Agrrement.

Regards

Bhavesh

mona_mehta
Participant
0 Kudos

Thanks Bhavesh,

I'll create another one then, and try this solution

Regards,

Mona

ravi_raman2
Active Contributor
0 Kudos

Mona,

This is what i do..

1) Parametrize ur current calling class,

2) define a separate class called dbConnect.java there, you have all your parameters that way when there is a change your main program is untouched, and you just need to change the dbconnect.

The call from your current class will be just like

dbConnect.Runsql("sql as a string");

the runSql can then internally call

dbConnect().connect(); //that should do the connection opening.

then create a prepared statement from your string input and call the db.......

this is the implementation that would be best suited for your scenario, you can further parametrize the method to where you can add the database params from the calling xml..so all that needs to be done when the machine is changed or any param is changed is ..modify the xml........not too bad was that.....

Regards

Ravi

mona_mehta
Participant
0 Kudos

Thanks Ravi,

But does this mean that i have to change the class...whether i define a different one with parameters..

and it with my main class.

I think i'll have to notify this in my Transport document then.

Any other suggestions.

Regards

Mona

ravi_raman2
Active Contributor
0 Kudos

Yes, the setup i suggested is a one time, by definition in java you should be calling a dbconnect to connect to the db and also to run the sql code.

yes you might have to modify your transports. that should be the last problem you have..ever..good design takes care of issues that may come up later..and you have done that now with the change..

Have fun

Regards

Ravi Raman