Wednesday, 28 April 2010

Explain how jdbc client getting connected to database server?

Explain how jdbc client getting connected to database server?

=>By using the following statement jdbc client made connection to database server

connection con=DriverManager.getConnection();

=>object oriented representation of clients login into the database server is nothing but connection object ,as long as the session is active,client performs any no of crud operations.


What is ResultSet?

What is ResultSet?
=>Object Oriented Representation of a table of records retrieve from the database into jdbc client is nothing but Resultset.
=>ResultSet object has the folowing logical struct ure.

=>As soon as the ResuleSet is opened i.e.ResultSet is created the logical pointer knomn as cursor points to the zero record area of the ResultSet.

=>Processing of record or row from the ResuleSet is nothing but reading the column values from the Record.

=>when cursor is pointing to the zero record area or no record area we should n't process the record of the ResultSet otherwise Sql exeception is raised.

=>we need to process the record only when cursor points to Records area .

=>Resultset object has methods to move the cursor and read the column values.

=>Most frequently used method to move the cursor within the Resultset is next().

=>when next() method is called on resultset object it does two things.

1.moving the cursor in forword direction by one direction.
2.returning true if record exists there , otherwise return false.

=>To read column values get---() method are called on the ResultSet object.

e.g: getInt(column number);
e.g:getFloat(column number);

=>These methods take coloumn number of the resultset row as argument and return the value.