JDBC Tutorials

11. Common SQL Commands

By: Lakshmi : 2007-10-12

Description: SQL commands are divided into categories, the two main ones being Data Manipulation Language (DML) commands and Data Definition Language (DDL) commands. DML commands deal with data, either retrieving it or modifying it to keep it up-to-date. DDL commands create or change tables and other database objects such as views and indexes.


12. WHERE Clauses in SQL

By: Jagan : 2007-10-12

Description: The WHERE clause in a SELECT statement provides the criteria for selecting values. For example, in the following code fragment, values will be selected only if they occur in a row in which the column Last_Name begins with the string 'Washington'.


13. Result Sets, Cursors and Transactions in SQL

By: Manoj Kumar : 2007-10-12

Description: When one user is accessing data in a database, another user may be accessing the same data at the same time. If, for instance, the first user is updating some columns in a table at the same time the second user is selecting columns from that same table, it is possible for the second user to get partly old data and partly updated data. For this reason, DBMSs use transactions to maintain data in a consistent state (data consistency) while allowing more than one user to access a database at the same time (data concurrency).


14. Stored Procedures example in SQL

By: Norman Chap : 2007-10-12

Description: A stored procedure is a group of SQL statements that can be called by name. In other words, it is executable code, a mini-program, that performs a particular task that can be invoked the same way one can call a function or method. Traditionally, stored procedures have been written in a DBMS-specific programming language. The latest generation of database products allows stored procedures to be written using the Java programming language and the JDBC API. Stored procedures written in the Java programming language are bytecode portable between DBMSs. Once a stored procedure is written, it can be used and reused because a DBMS that supports stored procedures will, as its name implies, store it in the database.


15. Using the DriverManager Class vs Using a DataSource Object for a connection

By: Reema Sen : 2007-10-12

Description: The DriverManager class works with the Driver interface to manage the set of drivers available to a JDBC client. When the client requests a connection and provides a URL, the DriverManager is responsible for finding a driver that recognizes the URL and for using it to connect to the corresponding data source. Connection URLs have the following form:


16. Creating Database Tables Using ANT

By: Sri Ganesh : 2007-10-12

Description: First, you can use a properties file to feed ANT, which has a simple sql target. Create a simple properties file, such as the one below:


17. PreparedStatement Example in Java

By: Tamil Selvan : 2007-10-12

Description: Sometimes it is more convenient to use a PreparedStatement object for sending SQL statements to the database. This special type of statement is derived from the more general class, Statement, that you already know.


18. Joins example in SQL

By: Kamini : 2007-10-12

Description: A distinguishing feature of relational databases is that it is possible to get data from more than one table in what is called a join. Suppose that after retrieving the names of employees who have company cars, one wanted to find out who has which car, including the make, model, and year of car. This information is stored in another table, Cars, shown in Table below.


19. SELECT Statements

By: Ivan Lim : 2007-10-12

Description: A SELECT statement, also called a query, is used to get information from a table. It specifies one or more column headings, one or more tables from which to select, and some criteria for selection. The RDBMS returns rows of the column entries that satisfy the stated requirements. A SELECT statement such as the following will fetch the first and last names of employees who have company cars:


20. JDBC Basics and JDBC Components

By: Henry : 2007-10-12

Description: This short code fragment instantiates a DriverManager object to connect to a database driver and log into the database, instantiates a Statement object that carries your SQL language query to the database; instantiates a ResultSet object that retrieves the results of your query, and executes a simple while loop, which retrieves and displays those results. It's that simple.