Which of the following actions will result when the above code is executed?

Consider the following Java code (assume all necessary import statements are defined):
DataSource ds;
try {
ctx = new InitialContext();
ds = (DataSource) ctx.lookup(“EmployeeDatabase”);
Connection con = ds.getConnection(“EmployeeDatabase”, “userid”, “password”);
}
catch (Exception ne)
{
System.out.println(“There was an Exception!”);
}
Which of the following actions will result when the above code is executed?

Consider the following Java code (assume all necessary import statements are defined):
DataSource ds;
try {
ctx = new InitialContext();
ds = (DataSource) ctx.lookup(“EmployeeDatabase”);
Connection con = ds.getConnection(“EmployeeDatabase”, “userid”, “password”);
}
catch (Exception ne)
{
System.out.println(“There was an Exception!”);
}
Which of the following actions will result when the above code is executed?

A.
The code will utilize a JDBC URL to locate a database.

B.
A call will be made to JNDI.

C.
A connection pool called EmployeeDatabase will be initialized.

D.
The code will not compile.



Leave a Reply 0

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