cancel
Showing results for 
Search instead for 
Did you mean: 

how to Cache Data from database for java mapping ?

former_member181928
Participant
0 Kudos

Hi

I have a scenario where i have to dynamically query a huge table in some other database from java mapping code.

Therefore instead of making a new Database trip everytime is there a mechanism by which i can cache the entire table contents into XI first and then use this cache for looking up data through my java mapping.

Any other alternative also welcome which would give best performance.

Please Suggest

regards

Nilesh Taunk.

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Nilesh,

I am not sure if you can actually cache the table in XI. You will have to look up directly from your Database everytime your mapping excecutes.

To perform DB lookup during mapping very efficiently, I would suggest that you take a look at this blog,

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

Also, instead of doing the DB look up in mapping, you can also use your JDBC adapter as a sender and collect the information you want from your DB,

If you are using your JDBC as a sender, then your JDBC will poll over your database and select the rows that satisfy your Select Query. Also, there is another field in your JDBC adapter that is very important and that is the Update satatement. Once your JDBC adapter executes your select query and selects rows from the database, you might not need those rows to be selected again. In this csse, you can use the Update statement to update the database.

http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

The choice between a JDBC sender adapter , and the DB lookup will have to be on the basis of your requirements.

Regards,

Bhavesh

former_member181928
Participant
0 Kudos

The lookup code to the external database has to be written a user defined function or can i embed that code in the java mapping source code also...

And if i implement a user defined function for it how do acess the user defined func from my java mapping source code.

regards

Nilesh Taunk.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Nilesh,

The look up code can be written in your Java Mapping code itself. it is not necessary for you to go for Graphical mapping and define an User Defined Function.

Also, it is possible to write the Look Up code in a separate Java Class, import it as a JAR in your mapping and this class can also be refereed to in your Java Mapping by importing the corresponding JAR file into your Java Mapping code. I would say that this is just another way of doing it and it wouldnt matter whether you put the code in a user defined function, or a separate class or within the Java Mapping itself.

Another point to note is that as the Business System and the Communication Channel have to be entered in your java code itself, one way of making it generic instead of Hard Coding the details would be to do a properties file look up in your Java Mapping.

Hope this input helps,

Regards,

Bhavesh

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Nilesh,

On an after thought if you decide to use a separate class / user defined function and are wondering how to use it in your Java Mapping code, just refer to this thread below and my reply,

Regards,

Bhavesh

Answers (0)