Suppose the myTable
database does not exist and we are using a JDBC 4.0 driver.
Which is the outcome of this code?.
String url = "jdbc:derby:myTable"; try (Connection conn = DriverManager.getConnection(url); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select count(*) from myTable")) { System.out.println(rs.getInt(1)); }
myTable
table.C.
JDBC 4.0 allows, but does not require, a call to the Class.forName()
method.
Since the database does not exist, DriverManager.getConnection()
throws a SQLException, and Option C is the answer.