0% found this document useful (0 votes)
7 views7 pages

Programming Assignment Unit 7

The document discusses the importance of SQL transactions for ensuring data integrity and consistency in an online marketplace, emphasizing the ACID properties. It also covers the roles of static, dynamic, and embedded SQL in database operations, as well as the use of JDBC and ODBC for database connectivity. The conclusion highlights the need for a balanced approach to SQL usage and connectivity to maintain performance and scalability in the application.

Uploaded by

Lutalo Michael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views7 pages

Programming Assignment Unit 7

The document discusses the importance of SQL transactions for ensuring data integrity and consistency in an online marketplace, emphasizing the ACID properties. It also covers the roles of static, dynamic, and embedded SQL in database operations, as well as the use of JDBC and ODBC for database connectivity. The conclusion highlights the need for a balanced approach to SQL usage and connectivity to maintain performance and scalability in the application.

Uploaded by

Lutalo Michael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

UNIVERSITY OF THE PEOPLE (UoPeople)

CS 2203-01 - Databases 1

Lutalo Martin

BSc. Computer Science

CS 2203-01 - AY2025-T4 / Programming Assignment Unit 7

Instructor Baraka Laiza

28th May 2025


When building a reliable and scalable online marketplace platform, it is vital to know how to use

SQL transactions, how to execute SQL, and database connection specifications such as JDBC and

ODBC for data integrity, operational efficiency, and database interaction.

a) Importance of transactions for data integrity and consistency

Transactions provide a necessary layer of data integrity and consistency when it comes to the

online market place, especially when performing critical operations such as processing orders or

tracking inventory updates. A transaction will take several database operations and group them

together as a single atomic unit which will either commit all changes all together or roll all

changes back if a part of the transaction fails (see Datacamp, 2024; Zanini, 2023). This atomicity

ensures that partial updates don't occur to keep things consistent. For example, an update that

deducts from an inventory count without recording a corresponding order could lead to

inconsistent and erroneous states.

In practice, a user makes an order (or purchase), and the system needs to update the order table,

update inventory levels, and possibly update the user transaction history. Perform all of these

changes in a transaction. With a transaction, all of the changes are either successful, or they fail. If

anything fails (e.g., the payment processor returns an error), the transaction will roll back, and

database consistency is maintained. If not managed properly, the user may sell products they do

not have because of inconsistencies in the database, or worse, possibility of orphan orders

(Pingcap, 2023).

The properties of ACID (Atomicity, Consistency, Isolation, and Durability) define how a

transaction should behave in order for the processing to be considered reliable (Vidhya et al.,
2016). For instance, isolation guarantees that concurrent transactions do not interfere (e.g., if two

users try to complete an order at the same time ensure one transaction will win while the other will

fail and never cause a race condition).

b) Role of static, dynamic, and embedded SQL

Static SQL represents SQL statements predetermined at compile-time. Static SQL is the fastest

and the most secure option, given that the database will pre-compile and optimize execution plans

for executing static SQL. Typical operations of getting product listings or user profiles of users as

a static SQL execution is ideal due to the known inputs of the operation (IBM, 2021).

Dynamic SQL is those constructed and executed at runtime. Dynamic SQL is used as a way to be

flexible and run a SQL query dependent on a user or variable condition. An example where

dynamic SQL was required was when users in the marketplace were applying search filters having

variable parameters, where the application required one of the search filters as one of the

parameters to dynamically build a SQL query based on the user input, thus not knowing what filter

query was returned until runtime. While dynamic SQL offers flexibility to the initial development,

one needs to be cautious about performance impacts; also consider using logic to prevent an SQL

injection (GeeksforGeeks, 2022).

Embedded SQL is SQL statements that are written as a terminal for a host SGML supplied in

languages such as Java or C. Embedded SQL allows developers to fluidly apply business logic to

database data as a typographical similarity to program code. The inclusion of variables to pass

information from a program to SQL is called Special Query Language Host Variables. Special
Query Language Host Variables provided an efficient way to manipulate data from the business

application code (Vidhya et al., 2016).

Within the context of the created online marketplace, embedded SQL allowed the application to

run database commands as the business logic of a module, and static and dynamic SQL to cater for

fixed as well as mutable and flexible queries.

c) Utilizing JDBC and ODBC for database connectivity

JDBC (Java Database Connectivity) is the standard Java API to connect and issue queries to

relational databases. JDBC standardizes how to interact with multiple different databases through

JDBC drivers. In our marketplace platform, the Java-based backend service uses JDBC to

interface connections to the database, execute SQL statements, and process result sets (Baeldung,

n.d.).

JDBC allows the application to use connection pools, enabling multiple concurrent connections to

the database, thereby allowing the application to scale. Prepared statements will limit SQL

injection and improve performance through pre-compilation of the SQL and parameters.

Open Database Connectivity (ODBC) is a language-independent data access application

programming interface (API) that allows application access to various database management

systems via a common interface. JDBC is more commonplace for Java applications, while ODBC

can be used in varying environments or when interacting with legacy systems, provided that the

database supports ODBC drivers (Insightsoftware, 2023).


For the purposes of supporting the marketplace's functionality, JDBC would be preferred due to its

tight integration with Java. ODBC may be used when support for interoperating with other

components or tools is needed.

Conclusion

By utilizing ACID compliance for transactions, data integrity is ensured when processing

important operations such as the processing of an order. In addition, deciding to use static,

dynamic, and embedded SQL based on the application requirements will achieve the best

compromise of performance and flexibility for database operations. Incorporating JDBC and

ODBC will facilitate a solid, scalable connection between the application and database systems as

well as controlling data management in the online environment.


References

Baeldung. (n.d.). A guide to JDBC. https://www.baeldung.com/java-jdbc

Datacamp. (2024). Understanding SQL Transactions: A Comprehensive Guide.

https://www.datacamp.com/tutorial/sql-transactions

IBM Data Server Client Packages. (2021, March 8). Designing static and dynamic SQL statement

execution in embedded SQL applications. https://www.ibm.com/docs/en/dscp/10.1.0?

topic=designing-static-dynamic-sql-statement-execution-in-embedded-sql-applications

Insightsoftware. (2023, June 10). What is ODBC – Open database connectivity.

https://insightsoftware.com/blog/what-is-odbc/

Pingcap. (2023). Understanding SQL Transactions for Data Integrity.

https://www.pingcap.com/article/understanding-sql-transactions-for-data-integrity/

Vidhya, V., Jeyaram, G., & Ishwarya, K. (2016). Database management systems. Alpha Science

International.

Zanini, A. (2023, February 14). Database transactions 101: The essential guide. DbVisualizer.

https://www.dbvis.com/thetable/database-transactions-101-the-essential-guide/

GeeksforGeeks. (2025, March 12). Transaction in DBMS. GeeksforGeeks.

https://www.geeksforgeeks.org/transaction-in-dbms/

GeeksforGeeks. (2022, November 9). Difference between Static and Dynamic SQL.

GeeksforGeeks. https://www.geeksforgeeks.org/difference-static-dynamic-sql/

GeeksforGeeks. (2025, April 17). Establishing JDBC connection in Java. GeeksforGeeks.

https://www.geeksforgeeks.org/establishing-jdbc-connection-in-java/
Patel, D. (2023, December 17). Understanding ODBC and JDBC: A Beginner’s guide to database

connectivity. Medium. https://medium.com/@divyansh9144/understanding-odbc-and-jdbc-

a-beginners-guide-to-database-connectivity-44d92b22eab6

You might also like