Class TeamCityJdbcDrivers

  • All Implemented Interfaces:
    JdbcDrivers

    public class TeamCityJdbcDrivers
    extends Object
    implements JdbcDrivers
    Loaded JDBC drivers. Holds a list of explicitly loaded JDBC drivers, and can provide one by conenction URL or connection URL and concrete class.
    • Method Detail

      • getClassLoader

        @NotNull
        public ClassLoader getClassLoader()
        The classloader provided via constructor.
        Specified by:
        getClassLoader in interface JdbcDrivers
        Returns:
        class loader.
      • findDefaultDriver

        @Nullable
        public Driver findDefaultDriver​(@NotNull
                                        DatabaseType dbType)
        Provides with the default driver for the specified database type.
        Specified by:
        findDefaultDriver in interface JdbcDrivers
        Parameters:
        dbType - type of the database.
        Returns:
        the driver, or null if no applicable drivers.
      • findDriver

        @Nullable
        public Driver findDriver​(@NotNull
                                 String connectionString)
        Looks for a situable driver (one that accepts the given url, see Driver.acceptsURL(String)).
        Specified by:
        findDriver in interface JdbcDrivers
        Parameters:
        connectionString - url to check for.
        Returns:
        found suitable driver, or null if not found.
      • getDriver

        @NotNull
        public Driver getDriver​(@NotNull
                                String connectionString,
                                @NotNull
                                String className)
                         throws NoSuitableJdbcDrivers
        Looks for the specified JDBC driver, checks the given URL and returns this driver if all OK.
        Specified by:
        getDriver in interface JdbcDrivers
        Parameters:
        connectionString - url to check for.
        className - driver class name.
        Returns:
        found suitable driver.
        Throws:
        NoSuitableJdbcDrivers - when no such class found or the specified driver doesn't accept the given URL.
      • unregisterAll

        public void unregisterAll()
        Check whether there is a JDBC driver suitable for the given URL.
        Specified by:
        unregisterAll in interface JdbcDrivers
        Parameters:
        url - url to check for.
        See Also:
        getDriver(String)
      • getDriverLocation

        @Nullable
        public File getDriverLocation​(@NotNull
                                      Driver driver)
        Description copied from interface: JdbcDrivers
        Returns location of jar file containing specified JDBC driver.
        Specified by:
        getDriverLocation in interface JdbcDrivers
        Returns:
        location of jar file on disk, or null if location cannot be determined for some reason.