The Tutorial help in understanding JDBC Next. The program describe a code that gives you the number of rows in the table. The code include a class JDBC Next, Inside the class we have a main method that follows the list of steps to get the number of rows in a table -
Import a package java.sql.* : This package provides you set of all classes that enables a network interface between the front end and back end database. Loading a driver is the next step to be followed by calling a class.forName( ),this accept a driver class as argument.
DriverManager.getConnection( ) : The Driver Manager call a get Connection method ,which return a connection object, this object built a connection between url-backend.
con.createStatement ( ) : This is used to create sql object. An object of connection class is used to send and execute the sql queries in database.
execute Query( ) : This is used to retrieve the record set from the database and the retrieve record set is assigned in Result Set. The select statement is used to retrieve the record set from table.
Finally the rs.next ( ) is used to retrieve the next sequence element in the series.
The println print the number of row as output.
No. of Row :2
Posted on: November 18, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles