This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
This project discuss the working with Transactional Savepoints in the context of JDBC 3.0 and manage transaction in JDBC 3.0 application. A brief background of JDBC and the report focuses on the defining the classified layers in JDBC architectural and Identify different types of JDBC. The working with Transactional Savepoints application shortly represents the state of data and schemas at a particular point in time within a unit of work. The report concluded that the transactional Savepoints is a special and unique feature of JDBC 3.0 that allows the association of JDBC transaction by using Savepoints thus ensuring that persisted data is all time in a reliable condition. It is suggested that is other times is advantageous to have more control over a transaction than simply rolling back every change in the current transaction. With JDBC 3.0 is a control with savepoints.
This project introduces the working with transactional savepoints in the context of JDBC 3.0 and undermines the advance additional transactional savepoints feature in JDBC 3.0.
Java application requires the connection to a data source to store and extract information on the data source. So Java application need an interface to work easily and consistently together with the data sources.. JDBC 3.0 gives such an interface that allows to develop applications to connect to the various types of data sources and perform such operations.
According to the recently released JDBC 3.0 articles, books, journals, sites and magazines. Java application cannot directly connect to a data source, it read only the Structured Query Language codes and not Java language codes. For the reasons, that its mechanism to translate Java codes into Structured Query Language code JDBC 3.0 provides the best ways for that kind of translation.
The objectives of this report is to fully describe what is JDBC and the JDBC architecture, state the design goals of JDBC and discusses the transactional savepoints in JDBC.
3.1 WHAT IS JDBC?
According to by Relly,(2000) JDBC is shortly for Java Database Connectivity. JDBC was established by JavaSoft, a sub branch of Sun Microsystems, to provide Java developers with simple standard Application Programmers Interface that operated on the of the databases and execute the SQL statements. It is composed of a complex set of classes, interfaces, exceptions and a specification written in Java programming languages. Relly,(2000) state that the use of JDBC, is a simple and easy way to associate with any data sources. Since all relational database management systems (DBMSs) allows SQL, and because Java by its own runs on many platforms, JDBC allows it to write a single database application that can run on different platforms and interact with different DBMSs. Java is secure, robust, reliable, easy to understand and use, JDBC extends its acceptations of the functionality of Java. The combination of Java and JDBC makes disseminating information easy and economical. JDBC is similar to ODBC, but is designed specifically for Java programs, whereas ODBC is language-independent.
3.2 JDBC ARCHITECTURE
Java programmers are unable to work with a database sending data and extracting the results of what is required. The reason behind that is because a database can read only the SQL statements and not Java language statements. Either a unique mechanism to translate Java Statements into SQL statements is needed. The JDBC architecture allows all the best kinds of translation to be undertaken. ( khan.,2006)
The JDBC architecture is just have only two layers:
JDBC application layer: Asbury et-al.,(2001) state that packages that allows JDBC coding interface is falling in "java.sql" and "javax.sql".It makes consistently to the Java codes which uses the JDBC API to work together with the JDBC drivers. Asbury et-al.,(2001) says JDBC driver is a basic software that a Java application uses to connect to a database and JDBC driver manager of JDBC API associate the Java connections to the driver.
JDBC driver layer: Is a middleman between a Java application and available data source. This layer is composed with some drivers, such as a SQL driver and Oracle driver, thatââ‚¬â„¢s enhance the relationship to some related data sources. They send the request to the Java application to the data source. After processing the request database feed-back the response straight to the driver. Then driver translates and sends the response to the JDBC API. JDBC API by-pass it to the Java application. (Asbury et-al.,2001)
According to Weiner S.R.,(2001) a transaction is a series of different several operations that have to work together for a common goal automatically, or as if they are a single, indivisible operation. With help of data sources, transactions build many database applications into a single body. If h a function requires to undertake multiple SQL statements to satisfy one objective (such, an inventory management system that needs to move items from an INVENTORY table to a SHIPPING table), its best to use JDBC's transaction services to archive the objective.
The most important feature in JDBC is a transactional savepoints and usually used on data source transactions where were "all or nothing" method of events. A application then resumes a transaction, it can enter some rows, update, and then also design some changes permanent (commit) or reject all changes (rollback). Either all changes has to be designed forever or none of changes would be forever. In JDBC 3.0, the transactional replica is easier. A function may start transaction, insert rows and then come up with a new savepoint. This savepoint works as a bookmark. The function can then perform some if/then/else type of sense such as updating a group of rows. With JDBC 2.0, the application would now have to either commit all the changes or rollback all the changes. With JDBC 3.0, the application might conclude that the updates made were a bad idea but the initial inserts were okay. The application can roll back to the savepoint (the bookmark) and, then, commit the group of inserts as if the updates have never been attempted.(Stephen Khan,2006).
Transaction hold up in JDBC 2 provide developers a control more than parallel approach to their data, thereby maintaining that stored data is always in a good condition. It is sometimes pleasing to have many controls over a transaction than simplifies roll back every change in the available transaction. With JDBC 3.0 that control is given with savepoints. The Savepoint interface allows to partition a transaction into logical breakpoints, providing control over how much of the transaction gets rolled back.(Weiner S.R.,2001)
Rollback to Savepoint operates the following functions; the whole transformations operated on the process of the transaction while the savepoint was designed are unraveled. All savepoints designed behind the one identified are shattered. All previous save points are stored, act as the savepoint by it own. It means that you can roll to the savepoints many times. All implicit and explicit record locks acquired while the operation is free. Other transactions that have asked to access to rows locked after the save point must continue to wait until the transaction is committed or rolled back. (Fisher, M. in The Java Tutorial [online] at http://java.sun.com/docs/books/tutorial/., 29 January 2011).
This report has conclude what the JDBC is stand for in full. Java Database Connectivity is an application programming interface (API) that describes a standard Java library for accessing data sources, primarily relational databases, which use the Structured Query Language. JDBC is modeled after the ODBC architecture and Java programmers use JDBC for most database access calls.
In order to make JDBC simple and efficient to use, access to specific databases is managed by drivers that implement a common set of Java interfaces. This allows the database connectivity provider, or driver programmer, to use whatever mechanisms are needed to create a high-performance database connection while making it easy for programmers to change database without changing a lot of code.
Savepoints divide long transactions, to work easily on various applications. For example, the operation applies on various applications, it spot a savepoint prior to every operation. In that case, if an application is unsuccessful, can be capable to reinstate Oracle information to its previous position, improve, and then re execute the operation. A transaction is a sequence of different rationally interconnected SQL statements that classify to achieve a number of tasks. Oracles undertake sequence of SQL statements as a component so that all transform brought on the statements are also committed (prepared completely) or rolled back (undone) once. If the application refuses to run during the process of transaction, then data source is by design to reinstate to the previous (pre-transaction) state.
Asbury et-al.,(2001).Java and Design Patterns in JDBC.USA; Parson Press
David Relly,(2000). Getting Started with JDBC. New York; University Press.
Stephen Khan,(2006). A Brief Introduction to JDBC. Delhi; Wiley Press.
Weiner S.R.,(2001). Developing Java Enterprise Applications, Second Edition.India; Wiley & Sons Ltd
Fisher, M.( Last updated: Monday, June 05, 2006) JDBC Database Access, in The Java Tutorial [online] at http://java.sun.com/docs/books/tutorial/(Accessed on the 29 January 2011)