Which code fragment can be inserted at line n1 to enable the code to print Connection Established?

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

Download Printable PDF. VALID exam to help you PASS.

2 thoughts on “Which code fragment can be inserted at line n1 to enable the code to print Connection Established?

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.