Class JKDataSourceFactory

java.lang.Object
com.jk.data.datasource.JKDataSourceFactory

public class JKDataSourceFactory extends Object
This class is a factory for creating and managing JKDataSource instances.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Details

    • JKDataSourceFactory

      public JKDataSourceFactory()
  • Method Details

    • getDefaultDataSource

      public static JKDataSource getDefaultDataSource()
      This method gets the default data source.
      Returns:
      the default data source.
    • getDataSource

      public static JKDataSource getDataSource(String prefix)
      This method retrieves a JKDataSource instance with the specified prefix.
      Parameters:
      prefix - Specifies the prefix used to identify the data source configuration.
      Returns:
      a JKDataSource instance configured with the specified prefix.
    • createDataSource

      public static JKDataSource createDataSource(String driver, String url, String userName, String password, Class<?> dialect, String datasourceName)
      This method creates a new JKDataSource instance with the provided database configuration.
      Parameters:
      driver - Specifies the JDBC driver class name.
      url - Specifies the JDBC URL for the database connection.
      userName - Specifies the database user name used for authentication.
      password - Specifies the database password used for authentication.
      dialect - Specifies the dialect class for the database.
      datasourceName - Specifies the name of the data source.
      Returns:
      the newly created JKDataSource instance.
    • createDataSource

      public static JKDataSource createDataSource(String name, Properties prop)
      This method creates a new JKDataSource instance with the provided name and properties.
      Parameters:
      name - Specifies the name of the data source.
      prop - Specifies the properties containing database configuration.
      Returns:
      the newly created JKDataSource instance.
    • close

      public static void close()
      This method closes all JKDataSource instances and de-registers JDBC drivers associated with them.
    • closeDrivers

      public static void closeDrivers()
      This method de-registers all JDBC drivers that have been registered with the DriverManager.