Course: Database Systems Week 4: Discussion 1 Discussion 1 (Chapter 9): Discuss the correspondences between the ER model constructs and the relational model constructs. Show how each ER model construc

Reply posts for the below:

Post 1:

Michael

Week 4 Discussion 2

COLLAPSE

Top of Form

The three main database programming approaches outlined by Elmasri and Navathe (2017) are embedded SQL, the Library of classes and function calls, and designing a database programming language. One advantage of embedded SQL is that it features query text as the main program source code and is checked against the database schema and syntax errors at compile time (Elmasri & Navathe, 2017). The SQL code is directly embedded in the program, using languages like JAVA or C, and is initialized by the EXEC SQL command. Since the queries are embedded, there is a loss of flexibility as they must be re-compiled if there are any runtime errors (Elmasri & Navathe, 2017). For more complex programs, it might be a more viable solution to use the function call approach. In the function call approach, functions can be created to connect to the database, prepare a query, and execute queries and updates (Elmasri & Navathe, 2017). For example, in a Java program, the JDBC library can create function calls to the database to perform various actions. A drawback to using this approach is that more complex programming is required as the types and numbers of attributes in a query result may not be known in advance and cannot be checked when the program is compiled (Elmasri & Navathe, 2017). The programmer will have to run the program to see errors exist. The final approach is the database programming approach, where a new database programming language is created or used, like PL/SQL (Elmasri & Navathe, 2017). Stored procedures are executed at the server level and can perform a variety of actions. These can be very useful but require programmers to learn a new language and be vendor-specific (Elmasri & Navathe, 2017).

One issue with these first two approaches that does not exist with the final approach is an impedance mismatch. This occurs when there is a difference between the database model and the programming language (Elmasri & Navathe, 2017). This could occur with the data types and column binding to access specific records.

 

Reference

Elmasri, R., & Navathe, S. B. (2017). Fundamentals of database systems (7th ed.). Pearson.

Post 2:


2 days ago

Andrea

Discussion

COLLAPSE

Top of Form

Elmasri & Navathe (2016) explained the advantages and disadvantages of the three main approaches for database programming:

  1. Embedding database commands in a general-purpose programming language: Since this approach uses the query text as part of the program source code itself, it makes it easy to check for syntax errors. It can also be validated against the database schema while the programming code is converted to the binary code (at compile time. It is considered a quite readable program due to the visibility in the source code. Among the disadvantages are the loss of flexibility when a query is changed at runtime. Every time there is a query change, the queries have to go through the entire recompilation process, which takes time.  Additionally, even though the application's programming can be easy for simple tasks when choosing program variables to hold the query results, it is suitable for complex applications. The function call approach would work better when the queries are unknown beforehand.

  2. Library of Classes and Function Calls Approach: One of the main advantages is flexibility when generating queries, which can be done at runtime if needed. However, this leads to one of the main disadvantages, which is dealing with more complex programming. Also, checking queries can't be done at compile time. This means that all syntax checking and query validation will happen in runtime while preparing the query. Therefore, additional runtime errors might happen.

  3. Database Programming Language Approach (designing a brand-new language): A big advantage of this approach is that impedance mismatch won't be a problem as all data types would be the same (programming language and database). But the main drawback is that it could be challenging for programmers since they would have to learn a new programming language, and it won't be the easiest to work with.

Reference:

Elmasri, R., & Navathe, S. B. (2016). Fundamentals of database systems (7th ed.). Pearson.

Bottom of Form

Bottom of Form