exam questions

Exam 1z0-809 All Questions

View all questions & answers for the 1z0-809 exam

Exam 1z0-809 topic 1 question 146 discussion

Actual exam question from Oracle's 1z0-809
Question #: 146
Topic #: 1
[All 1z0-809 Questions]

Given the code fragment:

Assume that dbURL, userName, and password are valid.
Which code fragment can be inserted at line n1 to enable the code to print Connection Established?

  • A. Properties prop = new Properties(); prop.put ("user", userName); prop.put ("password", password); con = DriverManager.getConnection (dbURL, prop);
  • B. con = DriverManager.getConnection (userName, password, dbURL);
  • C. Properties prop = new Properties(); prop.put ("userid", userName); prop.put ("password", password); prop.put("url", dbURL); con = DriverManager.getConnection (prop);
  • D. con = DriverManager.getConnection (dbURL); con.setClientInfo ("user", userName); con.setClientInfo ("password", password);
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
steefaand
5 months, 4 weeks ago
Selected Answer: A
A is correct.
upvoted 1 times
...
AVB22
2 years, 9 months ago
A is the answer, public static Connection getConnection(String url, Properties info) Parameters: url - a database url of the form jdbc:subprotocol:subname info - a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago