nerdexam
Oracle

1Z0-809 · Question #242

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…

The correct answer is A. Properties prop = new Properties(); prop.put("user", userName); prop.put("password", password); con = DriverManager.getConnection(dbURL, prop). You've hit your session limit · resets 5:20pm (America/New_York)

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);

How the community answered

(49 responses)
  • A
    76% (37)
  • B
    4% (2)
  • C
    14% (7)
  • D
    6% (3)

Explanation

You've hit your session limit · resets 5:20pm (America/New_York)

Community Discussion

No community discussion yet for this question.

Full 1Z0-809 Practice