Which of the following actions are performed by the code above?

Consider the following Java code:
DataSource ds;
try {
ctx = new InitialContext(env);
ds = (DataSource) ctx.lookup(“EmployeeDatabase”);
}
catch (NamingException ne)
{
System.out.println(“NamingException thrown!”);
}
Connection con = ds.getConnection();
Which of the following actions are performed by the code above?

Consider the following Java code:
DataSource ds;
try {
ctx = new InitialContext(env);
ds = (DataSource) ctx.lookup(“EmployeeDatabase”);
}
catch (NamingException ne)
{
System.out.println(“NamingException thrown!”);
}
Connection con = ds.getConnection();
Which of the following actions are performed by the code above?

A.
The code utilizes a JDBC URL to locate a database.

B.
The code establishes a connection with a database.

C.
The code utilizes JNDI.

D.
The code releases a connection to a database.



Leave a Reply 0

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