Transactional Importance:
In a database system, transactions are important to keeping data consistency and integration,
literally for an online marketplace place. Before committing the edits to the database, they make
sure that each process inner a transaction is ended correctly. To prevent partial edit that may lead
to data inconsistencies, the inner transaction is returned back whether any process fails.
Transactions are important for vital operations such as updating inventory standards and treating
orders. arrangement treating includes a number of actions, involving deleting the element from
inventory, updating the user's buying history, and editing the seller's account balance. Those
actions are ended in a transaction for example that either:
All steps are successfully ended, and the edits are committed as a whole, or
All edits are returned back to re-save the system to its main fixed condition in the event of a
failure (for example a system hitting or network issue).
b) SQL kinds' Role:
to actions which are made repeatedly and do not transfer, such gaining all goods in a type, fixed
SQL is faster and having more efficiency when it is precompiled and common at compile-time.
The cause of that is Dynamic SQL, queries which depend on user input, for example product
searches utilizing specific keywords, might be more flexible when SQL sentences could be made
at runtime.
Embedded SQL helps in the execution of more hard operations and logic, for example
confirming whether a user owns less credits before confirming a transaction, by mixing SQL by
a programming language for example C or Java.
c) Utilizing ODBC and JDBC:
JDBC (Java Database Connectivity) represents a Java API which leaves Java applications make
relations to databases, implement SQL queries, and gain data outside of them. JDBC might be
used inner your marketplace place to connect with the database to duties for example transaction
treating, product researches, and user authentication.
A known API for relating to database management systems (DBMSs) represents ODBC (Open
Database Connectivity). Not the consideration of the database system being used, it helps
programs to deliver database actions. That is particularly useful for online marketplace positions
which may need to treat more database forms for being scalable and interoperable .
This is a based explanation of how to relate to a database and execute a query utilizing JDBC:
import java.sql.*;
public class MarketplaceDB {
public static void main(String[] args) {
try {
// loading the JDBC driver
Class.forName("com.jdbc.Driver");
// found a connection
Connection con = DriverManager.getConnection("jdbc:subprotocol:subname", "user",
"password");
// make a sentence object to forward to the database
Statement stmt = con.createStatement();
// implement a query and recieve a result set
ResultSet rs = stmt.executeQuery("SELECT * FROM products");
// treat the result set
while (rs.next()) {
System.out.println(rs.getString("product_name"));
// Closing the resources
rs.close();
stmt.close();
con.close();
} catch (Exception e) {
e.printStackTrace();
}
This small piece of code explains how to relate to a database, execute a query to gain each
product, and treat the output.
Reference
Watt, A., & Eng, N. (2014). Database design, 2nd ed. BCcampus, BC Open Textbook Project.
Retrieved from https://opentextbc.ca/dbdesign01/
Design a database for e-commerce.
https://fabric.inc/blog/commerce/ecommerce-database-design-example
Transactions in databases
https://www.geeksforgeeks.org/difference-odbc-jdbc/
Connect to the database using JDBC
https://www.geeksforgeeks.org/establishing-jdbc-connection-in-java/