Oracle
1Z0-809 · Question #242
1Z0-809 Question #242: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #242. The question stem and answer options stay visible for context.
Question
Connection con = null;
try {
// line n1
if (con != null) {
System.out.print("Connection Established.");
}
} catch (Exception e) {
System.out.print(e);
}
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?
Options
- AProperties prop = new Properties(); prop.put("user", userName); prop.put("password", password); con = DriverManager.getConnection(dbURL, prop);
- Bcon = DriverManager.getConnection(userName, password, dbURL);
- CProperties prop = new Properties(); prop.put("userid", userName); prop.put("password", password); prop.put("url", dbURL); con = DriverManager.getConnection(prop);
- Dcon = DriverManager.getConnection(dbURL); con.setClientInfo("user", userName); con.setClientInfo("password", password);
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.