Thursday 20 May 2010

Database Schema names in xsd files created by database adapter.

We were facing a problem where when we invoke a stored procedure using a DB Adapter, the xsd file created for the adapter contained reference to the database schema. This was because we are using PLSQL Object and Table types. Object types are used inside a table types and table types can be used as an array.
But this becomes an issue when we need to move to a different environment where the database schema name will be different.
For e.g in the dev environment the xsd file contains db:DEVSCHEMA.EMP_TAB and in the test environment it will be db:TESTSCHEMA.EMP_TAB.
But this was causing an issue when deployed to a different environment as it was giving a conversion error of the table types to a Java type because of the schema name.

To get around this,
1. While using a DB Adapter, try to use the DEFAULT_SCHEMA option as much as possible.
2. If Schema references are created, go to the xsd file and remove them. For e.g db:DEVSCHEMA.EMP_TAB will be db:EMP_TAB.
3. Validate the xsd file to check if everything is working.
4. Check the JCA file if it has a database schema reference and remove it.
It should now work in all environments.

No comments:

Post a Comment