org.apache.torque.adapter

## Class AdapterFactory

- java.lang.Object
- - org.apache.torque.adapter.AdapterFactory

-     public final class AdapterFactory
      extends Object

  This class creates different `Adapter` objects based on specified JDBC driver name.
  Version:
    $Id: AdapterFactory.java 1870542 2019-11-28 09:32:40Z tv $
  Author:
    Frank Y. Kim, Jon S. Stevens, Brett McLaughlin, Ralf Stranzenbach, Daniel Rall, Henning P. Schmiedehausen

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Adapter` | `autoDetectAdapter(Connection con)` Creates a new instance of the Torque database adapter based on the JDBC meta-data
    `static Adapter` | `create(String key)` Creates a new instance of the Torque database adapter associated with the specified JDBC driver or adapter key.
    `static Adapter` | `create(String key, String className)` Creates a new instance of the Torque database adapter associated with the specified JDBC driver or adapter key and the class defined.
    `static void` | `setCapabilities(Connection con, Adapter adapter)` Update static capabilities of the Torque database adapter with actual readings based on the JDBC meta-data

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### autoDetectAdapter

          public static Adapter autoDetectAdapter(Connection con)
                                           throws InstantiationException,
                                                  SQLException

      Creates a new instance of the Torque database adapter based on the JDBC meta-data
      Parameters:
        `con` - a database connection
      Returns:
        An instance of a Torque database adapter, or null if no adapter could be detected.
      Throws:
        `InstantiationException` - if the adapter could not be instantiated
        `SQLException` - if there are problems getting the JDBC meta data

    - #### setCapabilities

          public static void setCapabilities(Connection con,
                                             Adapter adapter)
                                      throws SQLException

      Update static capabilities of the Torque database adapter with actual readings based on the JDBC meta-data
      Parameters:
        `con` - a database connection
        `adapter` - an adapter
      Throws:
        `SQLException` - if there are problems getting the JDBC meta data

    - #### create

          public static Adapter create(String key)
                                throws InstantiationException

      Creates a new instance of the Torque database adapter associated with the specified JDBC driver or adapter key.
      Parameters:
        `key` - The fully-qualified name of the JDBC driver or a shorter form adapter key.
      Returns:
        An instance of a Torque database adapter, or null if no adapter exists for the given key.
      Throws:
        `InstantiationException` - throws if the adapter could not be instantiated

    - #### create

          public static Adapter create(String key,
                                       String className)
                                throws InstantiationException

      Creates a new instance of the Torque database adapter associated with the specified JDBC driver or adapter key and the class defined.
      Parameters:
        `key` - The fully-qualified name of the JDBC driver or a shorter form adapter key.
        `className` - The fully qualified name of the adapter class
      Returns:
        An instance of a Torque database adapter.
      Throws:
        `InstantiationException` - throws if the adapter could not be instantiated

Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.