Java OCA OCP Practice Question 2021

Question

How many of the following could be valid JDBC URL formats for an imaginary driver named magic and a database named box?.

  • I. jdbc:magic:127.0.0.1:1234/box
  • II. jdbc:magic:box
  • III. jdbc:magic:@127.0.0.1:1234
  • A. None
  • B. One
  • C. Two
  • D. Three


C.

Note

A JDBC URL has three components separated by colons.

All three of these URLs meet those criteria.

For the data after the component, the database driver specifies the format.

Depending on the driver, this might include an IP address and port.

Regardless, it needs to include the database name or alias.

I and II could both be valid formats because they mention the database box.

However, III only has an IP address and port.

It does not have a database name or alias.

Therefore III is incorrect and Option C correct.




PreviousNext

Related