nerdexam
Oracle

1Z0-805 · Question #38

What design pattern does the Drivermanager.getconnection () method characterize?

The correct answer is B. Factory. DriverManager has a factory method getConnection() that returns a Connection object. Note 1:A factory method is a method that creates and returns new objects. The factory pattern (also known as the factory method pattern) is a creational design pattern. A factory is a Java…

Building Database Applications with JDBC

Question

What design pattern does the Drivermanager.getconnection () method characterize?

Options

  • ADAO
  • BFactory
  • CSingleton
  • Dcomposition

How the community answered

(31 responses)
  • A
    6% (2)
  • B
    74% (23)
  • C
    16% (5)
  • D
    3% (1)

Explanation

DriverManager has a factory method getConnection() that returns a Connection object. Note 1:A factory method is a method that creates and returns new objects. The factory pattern (also known as the factory method pattern) is a creational design pattern. A factory is a Java class that is used to encapsulate object creation code. A factory class instantiates and returns a particular type of object based on data passed to the factory. The different types of objects that are returned from a factory typically are subclasses of a common parent class. The method DriverManager.getConnection establishes a database connection. This method requires a database URL, which varies depending on your DBMS. The following are some examples of database URLs: MySQL, Java DB.

Topics

#Factory pattern#DriverManager#design patterns#JDBC

Community Discussion

No community discussion yet for this question.

Full 1Z0-805 Practice