Type a new keyword(s) and press Enter to search

Java for Databases

 

The connection represents a single instance of a database session. Through this connection SQL statements can be executed, data retrieved and updates, insertions and deletes can be done via the connected Java applet / application. Commits to the database are done automatically within the connection unless told otherwise.
             SQL statements are passed through the open connection via the java.sql.Statement class. The intention of this class is to pass the SQL statement from the Java application to the database for execution via an open connection. Any results returned from an SQL statement (query / fetch) will be stored in a ResultSet (java.sql.ResultSet). A statement can only have one ResultSet per execution. The drawback of this being the same statement cannot be run twice and the difference in the ResultSet compared, the second statement over writes the data of the first ResultSet. .
             The objective of the Statement interface is to pass to the database the SQL string for execution and to retrieve any results from the database in the form of a ResultSet. Only one ResultSet can be open per statement at any one time. For example, two ResultSets cannot be compared to each other if both ResultSets were returned from the same SQL statement. If an SQL statement is re-issued for any reason, the old ResultSet is automatically over written by the second.
             Lastly a ResultSet (java.sql.ResultSet) is the means of storing any data that needs to be returned from the database to the application. A ResultSet stores its any data it may hold in the form of a table. The ResultSet delivers the data to the application row by row, mirrored to how it was stored in the database. Once the last row of the table has been delivered the statement is considered to be completed and the ResultSet is closed.
             BENEFITS.
             A large part of Java's goals is to become portable Operating System independent platform. Though still in (accelerated) development progress has been made to connect Java applications to data sources that traditionally function with the ODBC client interface.


Essays Related to Java for Databases