Saturday, May 10, 2008

Java Interview Questions 54

266. What are the types of statements in JDBC?- Statement: to be used
createStatement() method for executing single SQL statement PreparedStatement — To
be used preparedStatement() method for executing same SQL statement over and over.
CallableStatement — To be used prepareCall() method for multiple SQL statements
over and over.

267. What is stored procedure?- Stored procedure is a group of SQL statements
that forms a logical unit and performs a particular task. Stored Procedures are
used to encapsulate a set of operations or queries to execute on database. Stored
procedures can be compiled and executed with different parameters and results and
may have any combination of input/output parameters.

268. How to create and call stored procedures?- To create stored procedures:
Create procedure procedurename (specify in, out and in out parameters) BEGIN Any
multiple SQL statement; END; To call stored procedures: CallableStatement csmt =
con. prepareCall(”{call procedure name(?,?)}”); csmt. registerOutParameter(column
no. , data type); csmt. setInt(column no. , column name) csmt. execute();

269. What is servlet?- Servlets are modules that extend
request/response-oriented servers, such as java-enabled web servers. For example, a
servlet might be responsible for taking data in an HTML order-entry form and
applying the business logic used to update a company’s order database.

270. What are the classes and interfaces for servlets?- There are two packages
in servlets and they are javax. servlet and

No comments:

Useful Information