There are different ways to handle dynamic schema in EGL. One of the very common approach is to get the schema from the jvm properties in egl handler and store it in the session and set it in a record "StatusRec" and pass to the data access layer as argument. For more details on this you can refer to http://64.233.183.104/search?q=cache:YfYe-ju-9dUJ:www.jsayles.com/ibm/TableNamesVariable.doc+EGL+StatusREc&hl=en&ct=clnk&cd=1" Below statement is quoted from this link
"You must then set the schema name in each function prior to running the EGL I/O statement. It is assumed that the schema will be a programmatically determined value and would be stored in session. Therefore, this example assumes the schema has been set in a jsfHandler by reading the data out of the session and passing it through the record StatusRecord (or status as generated by the data Access Application Wizard). The reason this record is used is that all functions created using the wizard include the status record in the pass parameters"-Mark Evans, Rational – EGL Development, IBM Software Group.
However I feel there is a overhead in this approach that is each time you want to make a database call you need to get the schema from the session and populate the schema variable in statusRec and then send it from egl handler to data layer. The overhead in this approach is you have to pass one extra record as parameter every time you make a call.There is another solution for reading the schema in data layer itself without passing schema name from handler every time. Create a library which will probably have two methods setDatabaseNameSchema and getDatabaseNameSchema. Get method will read the jvm properties and return to data layer. Set can be used to set the schema from anywhere. Set is useful when you are performing unit testing when your server is not ON.
"You must then set the schema name in each function prior to running the EGL I/O statement. It is assumed that the schema will be a programmatically determined value and would be stored in session. Therefore, this example assumes the schema has been set in a jsfHandler by reading the data out of the session and passing it through the record StatusRecord (or status as generated by the data Access Application Wizard). The reason this record is used is that all functions created using the wizard include the status record in the pass parameters"-Mark Evans, Rational – EGL Development, IBM Software Group.
However I feel there is a overhead in this approach that is each time you want to make a database call you need to get the schema from the session and populate the schema variable in statusRec and then send it from egl handler to data layer. The overhead in this approach is you have to pass one extra record as parameter every time you make a call.There is another solution for reading the schema in data layer itself without passing schema name from handler every time. Create a library which will probably have two methods setDatabaseNameSchema and getDatabaseNameSchema. Get method will read the jvm properties and return to data layer. Set can be used to set the schema from anywhere. Set is useful when you are performing unit testing when your server is not ON.






1 comment:
It works. I was looking for something like this. Keep posting . thanx
Post a Comment