Q. How u connected DataBase in your project?
Q. Write program to connect DataBase?
a) class.forname("drivername");
Connection con = DriverManager.getConnection(url, username, pwd);
Statement stmt = con.createStatement("sql querry");
ResultSet rs = stmt.executeQurey();
while (rs.next()){
.........= rs.getInt();
..........................;
..........................;
}
Q. Why driver manager?
Q. Is DriverManager class or interface?
a) DriverManager is interface.
Q. Different types of statements?
a) 1. statement 2. preparedStatement 3. callableStatement
Q. what is the purpose of preparedStatement?
a) prepareStatement holds precompiled statements and it will take arguments.
Q. How to call stored procedures using jdbc?
a) using callable statement.
Q. Write a program for callable statement?
a) callableStatement stmt = con.createCallableStatement(procedure name, arguments.......);
Q. Different types of arguments for callableStatement?
a) 1. in parameters 2. out parameters 3. inout parameters.
Q. how to send outparameters?
a) stmt.registerOutParameter(param name, value, datatype);
Q. Different types of methods on statement?
a) 1. execute() 2. executeQuery() 3. executeUpdate()
Q. Return type for execute()?
a) boolean. either statement executed properly or not.
Q. Return type for executeQuery()?
a) int no of rows
Q. Return type for executeUpdate()?
a) int no of rows effected.
Q. What is connection pooling?
Q. How to get connection using connection pooling?
Q. How to implement connection pooling by your self?
Q. How will you insert or delete with a single java connection when you have referential integrity?
Q. How to get table name, column names and no of columns?
Q. JDBC driver types?
Q. What driver you are using in your database?
Q. 4th driver URL?
Q. How you add 10 records at a time in DataBase?
a) using executeBatch();
Q. What is ResultsetMetaData?
Q. ResultSet points to which location by default?
a) before first record.
Q. What are ResultSet constants?
Q. How you handle database exception numbers?
Q. Is there any other exception other than SQLEception?
Q. Connection, Statement are interfaces which class type they will create objects?
a) They will create ananymous class type objects.
Q. which loads driver class loader or JVM?
Q. What is the purpose of RowSet?
a) 1. It stores tabular data 2. It is bidirectional 3. It allows updation of table
Q. RowSet properties?
a) 1. setCommand
2. setEscapeProcessing -- default on
3. setFetchDirection
4. setFetchSize
5. setMaxFieldSize
6. setMaxRows
7. setQueryTimeOut -- default no limit
8. setShowDeleted -- default is not to show deleted rows
9. setTransactionIsolation -- default not to see dirty reads
10. setTypeMap -- default is null
Q. RowSet EventListeners?
a) 1. cursor movement
2. update, insert, delete
3. A change to entire rowset contents
Q. What are different kids of RowSets?
a) 1. connected -------- jdbc RowSet
2. disconnected ------ catchedRowSet, WebRowSet, JoinRowSet, FilteredRowSet
Q. What is the purpose of catchedRowSet?
a) 1. Obtain a connection to a dataSource and executeQuery.
2. Read the data from the resulting ResultSet Object and populate itself with that data.
3. Manipulate data and make changes to data while it is disconnected.
4. Reconnect to the data source to write changes back to it.
5. Check for conflicts with the datasource and resolve those conflicts.
Q. What is the advantages of WebRowSet?
a) It has all the advantages of catchedRowSet and
1. Write it self as an XML document
2. Read an XML document that describes a webRowSet.
Q. What is the advantages of JoinRowSet?
a) It has all the advantages of catchedRowSet, WebRowSet and It form equalent of an SOLJoin with out having to connect to a data source.
Q. What is the advantages of FilteredRowSet?
a) all the advantages of catchedRowSet, WebRowSet,JoinRowSet and apply filter critaria.
Q. Difference between connectedRowSet and disconnectedRowSet?
a) disconnected is light wait and serializable.
Q. Difference between ResultSet and RowSet?
a) ResultSet is single directional and not updatable.
RowSet is bidirectional and updatable.
Q. How to make a ResultSet Scrollable?
a) ResultSet.TYPE_SCROLL_INSENSITIVE
ResultSet.CONCUR_UPDATABLE
Wednesday, January 16, 2008
JDBC Frequently Asked Questions
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment