A system and method is provided to dynamically map and replace SQL statements in a relational database. SQL statements impacted due to a schema evolution are identified and new SQL statements are then designed according to the evolved schema. Thereafter, the existing SQL statements are mapped to the new SQL statements.
A Method and System for Dynamically Mapping and Replacing SQL Statements in a
Relational Database
Disclosed is a method and system for dynamically mapping and replacing SQL statements in a relational database.
Storing new information in relational databases may result in a schema evolution due to changes in the structure of the relational databases. These changes impact applications that query the relational database, resulting in the SQL statements failing or giving unexpected results.
The method and system disclosed herein works at an application level to capture the SQL statements fired by the application that queries the relational database. The SQL statements are captured by intercepting calls to the relational database and are stored in an XML file. Thereafter, a set of the SQL statements which may be impacted due to the schema evolution are filtered.
New SQL statements are then designed according to the evolved schema. The new schema is
semantically the same as the schema corresponding to the existing SQL statements. The existing SQL statements are then mapped to the new SQL statements. The mapping is performed by intercepting the call to the relational database and performing a "lookup" into a map storing mapping information. The existing SQL statements may be mapped to the new SQL statements at a driver level without changing the application.
Thereafter, the ap...