Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

brainbench questions

843854Aug 24 2003 — edited Mar 5 2009
I have taken a j2ee brainbench test and following are the questions i cant figure out, can any one figure out the right answer?


Q1)Since ResultSet is NOT a serializable class, how do you pass data from one part or tier of a distributed application to another?
Choice 1
Read the ResultSet data and build the serializable object you need.
Choice 2
Use RowSet instead.
Choice 3
Data within the result set is what you need, not the entire result.
Choice 4
ResultSet has its own methods for converting to passable objects.
Choice 5
Serializability is not a requirement for passing data.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Q2)
Statement sql = con.createStatement();
ResultSet rs1 = sql.executeQuery(sqlString1);
ResultSet rs2 = sql.executeQuery(sqlString2);
String szValue1 = rs1.getString(1);
String szValue2 = rs2.getString(1);
What is the problem with the above sample code?
Choice 1
rs2 is invalid because rs1 was not closed before the second SQL.execute was called.
Choice 2
szValue1 is invalid because rs1 was closed when SQL.execute was called the second time.
Choice 3
szValue1 will be the same as szValue2.
Choice 4
szValue2 is invalid because a connection can only have one active resultset.
Choice 5
The second call to SQL.execute is invalid because the connection con was not closed.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 2 2009
Added on Aug 24 2003
7 comments
1,097 views