This topic contains a solution. Click here to go to the answer

Author Question: Analyze the following code: ResultSet resultSet = statement.executeQuery("select firstName, mi, ... (Read 61 times)

justinmsk

  • Hero Member
  • *****
  • Posts: 524

Question 1

Which of the following statements are true?
◦ You may create multiple statements from one connection.
◦ You can send queries and update statements through a Statement object.
◦ You may create multiple connections to a database.
◦ You may load multiple JDBC drivers in a program.

Question 2

Analyze the following code:

ResultSet resultSet = statement.executeQuery
("select firstName, mi, lastName from Student where lastName "
+ " = 'Smith'");
System.out.println(resultSet.getString(1));

◦ If the SQL SELECT statement returns no result, resultSet is null.
◦ resultSet.getString(1) returns the firstName field in the result set.
◦ resultSet.getString(1) returns the mi field in the result set.
◦ The program will have a runtime error, because the cursor in resultSet does not point to a row. You must use resultSet.next() to move the cursor to the first row in the result set. Subsequently, resultSet.next() moves the cursor to the next row in the result set.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by justinmsk on May 6, 2020

momtoalll

  • Sr. Member
  • ****
  • Posts: 326
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 25% of students answer this correctly




justinmsk

  • Member
  • Posts: 524
Reply 2 on: May 6, 2020
Wow, this really help


nathang24

  • Member
  • Posts: 314
Reply 3 on: Yesterday
Excellent

 

Did you know?

A seasonal flu vaccine is the best way to reduce the chances you will get seasonal influenza and spread it to others.

Did you know?

ACTH levels are normally highest in the early morning (between 6 and 8 A.M.) and lowest in the evening (between 6 and 11 P.M.). Therefore, a doctor who suspects abnormal levels looks for low ACTH in the morning and high ACTH in the evening.

Did you know?

Famous people who died from poisoning or drug overdose include, Adolf Hitler, Socrates, Juan Ponce de Leon, Marilyn Monroe, Judy Garland, and John Belushi.

Did you know?

More than 4.4billion prescriptions were dispensed within the United States in 2016.

Did you know?

Since 1988, the CDC has reported a 99% reduction in bacterial meningitis caused by Haemophilus influenzae, due to the introduction of the vaccine against it.

For a complete list of videos, visit our video library