/** * Returns an {@code Enumeration} that contains all of the loaded JDBC * drivers that the current caller can access. * * @return An {@code Enumeration} containing all the currently loaded JDBC * {@code Drivers}. */ public static Enumeration<Driver> getDrivers() { /* * Synchronize to avoid clashes with additions and removals of drivers * in the DriverSet */ ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { ArrayList<Driver> result = new ArrayList<Driver>(); for (Driver driver : theDrivers) { if (DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { result.add(driver); } } return Collections.enumeration(result); } }
/** * Removes a driver from the {@code DriverManager}'s registered driver list. * This will only succeed when the caller's class loader loaded the driver * that is to be removed. If the driver was loaded by a different class * loader, the removal of the driver fails silently. * <p> * If the removal succeeds, the {@code DriverManager} will not use this * driver in the future when asked to get a {@code Connection}. * * @param driver * the JDBC driver to remove. * @throws SQLException * if there is a problem interfering with accessing the * database. */ public static void deregisterDriver(Driver driver) throws SQLException { if (driver == null) { return; } ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); if (!DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { throw new SecurityException("calling class not authorized to deregister JDBC driver"); } synchronized (theDrivers) { theDrivers.remove(driver); } }
/** * Tries to find a driver that can interpret the supplied URL. * * @param url * the URL of a database. * @return a {@code Driver} that matches the provided URL. {@code null} if * no {@code Driver} understands the URL * @throws SQLException * if there is any kind of problem accessing the database. */ public static Driver getDriver(String url) throws SQLException { ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { /* * Loop over the drivers in the DriverSet checking to see if one * does understand the supplied URL - return the first driver which * does understand the URL */ for (Driver driver : theDrivers) { if (driver.acceptsURL(url) && DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { return driver; } } } // If no drivers understand the URL, throw an SQLException // SQLState: 08 - connection exception // 001 - SQL-client unable to establish SQL-connection throw new SQLException("No suitable driver", "08001"); }
/** * Returns an {@code Enumeration} that contains all of the loaded JDBC * drivers that the current caller can access. * * @return An {@code Enumeration} containing all the currently loaded JDBC * {@code Drivers}. */ public static Enumeration<Driver> getDrivers() { /* * Synchronize to avoid clashes with additions and removals of drivers * in the DriverSet */ ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { ArrayList<Driver> result = new ArrayList<Driver>(); for (Driver driver : theDrivers) { if (DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { result.add(driver); } } return Collections.enumeration(result); } }
/** * Returns an {@code Enumeration} that contains all of the loaded JDBC * drivers that the current caller can access. * * @return An {@code Enumeration} containing all the currently loaded JDBC * {@code Drivers}. */ public static Enumeration<Driver> getDrivers() { /* * Synchronize to avoid clashes with additions and removals of drivers * in the DriverSet */ ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { ArrayList<Driver> result = new ArrayList<Driver>(); for (Driver driver : theDrivers) { if (DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { result.add(driver); } } return Collections.enumeration(result); } }
/** * Returns an {@code Enumeration} that contains all of the loaded JDBC * drivers that the current caller can access. * * @return An {@code Enumeration} containing all the currently loaded JDBC * {@code Drivers}. */ public static Enumeration<Driver> getDrivers() { /* * Synchronize to avoid clashes with additions and removals of drivers * in the DriverSet */ ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { ArrayList<Driver> result = new ArrayList<Driver>(); for (Driver driver : theDrivers) { if (DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { result.add(driver); } } return Collections.enumeration(result); } }
/** * Returns an {@code Enumeration} that contains all of the loaded JDBC * drivers that the current caller can access. * * @return An {@code Enumeration} containing all the currently loaded JDBC * {@code Drivers}. */ public static Enumeration<Driver> getDrivers() { /* * Synchronize to avoid clashes with additions and removals of drivers * in the DriverSet */ ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { ArrayList<Driver> result = new ArrayList<Driver>(); for (Driver driver : theDrivers) { if (DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { result.add(driver); } } return Collections.enumeration(result); } }
/** * Returns an {@code Enumeration} that contains all of the loaded JDBC * drivers that the current caller can access. * * @return An {@code Enumeration} containing all the currently loaded JDBC * {@code Drivers}. */ public static Enumeration<Driver> getDrivers() { /* * Synchronize to avoid clashes with additions and removals of drivers * in the DriverSet */ ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { ArrayList<Driver> result = new ArrayList<Driver>(); for (Driver driver : theDrivers) { if (DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { result.add(driver); } } return Collections.enumeration(result); } }
/** * Removes a driver from the {@code DriverManager}'s registered driver list. * This will only succeed when the caller's class loader loaded the driver * that is to be removed. If the driver was loaded by a different class * loader, the removal of the driver fails silently. * <p> * If the removal succeeds, the {@code DriverManager} will not use this * driver in the future when asked to get a {@code Connection}. * * @param driver * the JDBC driver to remove. * @throws SQLException * if there is a problem interfering with accessing the * database. */ public static void deregisterDriver(Driver driver) throws SQLException { if (driver == null) { return; } ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); if (!DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { throw new SecurityException("calling class not authorized to deregister JDBC driver"); } synchronized (theDrivers) { theDrivers.remove(driver); } }
/** * Removes a driver from the {@code DriverManager}'s registered driver list. * This will only succeed when the caller's class loader loaded the driver * that is to be removed. If the driver was loaded by a different class * loader, the removal of the driver fails silently. * <p> * If the removal succeeds, the {@code DriverManager} will not use this * driver in the future when asked to get a {@code Connection}. * * @param driver * the JDBC driver to remove. * @throws SQLException * if there is a problem interfering with accessing the * database. */ public static void deregisterDriver(Driver driver) throws SQLException { if (driver == null) { return; } ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); if (!DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { throw new SecurityException("calling class not authorized to deregister JDBC driver"); } synchronized (theDrivers) { theDrivers.remove(driver); } }
/** * Returns an {@code Enumeration} that contains all of the loaded JDBC * drivers that the current caller can access. * * @return An {@code Enumeration} containing all the currently loaded JDBC * {@code Drivers}. */ public static Enumeration<Driver> getDrivers() { /* * Synchronize to avoid clashes with additions and removals of drivers * in the DriverSet */ ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { ArrayList<Driver> result = new ArrayList<Driver>(); for (Driver driver : theDrivers) { if (DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { result.add(driver); } } return Collections.enumeration(result); } }
/** * Removes a driver from the {@code DriverManager}'s registered driver list. * This will only succeed when the caller's class loader loaded the driver * that is to be removed. If the driver was loaded by a different class * loader, the removal of the driver fails silently. * <p> * If the removal succeeds, the {@code DriverManager} will not use this * driver in the future when asked to get a {@code Connection}. * * @param driver * the JDBC driver to remove. * @throws SQLException * if there is a problem interfering with accessing the * database. */ public static void deregisterDriver(Driver driver) throws SQLException { if (driver == null) { return; } ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); if (!DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { throw new SecurityException("calling class not authorized to deregister JDBC driver"); } synchronized (theDrivers) { theDrivers.remove(driver); } }
/** * Removes a driver from the {@code DriverManager}'s registered driver list. * This will only succeed when the caller's class loader loaded the driver * that is to be removed. If the driver was loaded by a different class * loader, the removal of the driver fails silently. * <p> * If the removal succeeds, the {@code DriverManager} will not use this * driver in the future when asked to get a {@code Connection}. * * @param driver * the JDBC driver to remove. * @throws SQLException * if there is a problem interfering with accessing the * database. */ public static void deregisterDriver(Driver driver) throws SQLException { if (driver == null) { return; } ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); if (!DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { throw new SecurityException("calling class not authorized to deregister JDBC driver"); } synchronized (theDrivers) { theDrivers.remove(driver); } }
/** * Removes a driver from the {@code DriverManager}'s registered driver list. * This will only succeed when the caller's class loader loaded the driver * that is to be removed. If the driver was loaded by a different class * loader, the removal of the driver fails silently. * <p> * If the removal succeeds, the {@code DriverManager} will not use this * driver in the future when asked to get a {@code Connection}. * * @param driver * the JDBC driver to remove. * @throws SQLException * if there is a problem interfering with accessing the * database. */ public static void deregisterDriver(Driver driver) throws SQLException { if (driver == null) { return; } ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); if (!DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { throw new SecurityException("calling class not authorized to deregister JDBC driver"); } synchronized (theDrivers) { theDrivers.remove(driver); } }
/** * Removes a driver from the {@code DriverManager}'s registered driver list. * This will only succeed when the caller's class loader loaded the driver * that is to be removed. If the driver was loaded by a different class * loader, the removal of the driver fails silently. * <p> * If the removal succeeds, the {@code DriverManager} will not use this * driver in the future when asked to get a {@code Connection}. * * @param driver * the JDBC driver to remove. * @throws SQLException * if there is a problem interfering with accessing the * database. */ public static void deregisterDriver(Driver driver) throws SQLException { if (driver == null) { return; } ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); if (!DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { throw new SecurityException("calling class not authorized to deregister JDBC driver"); } synchronized (theDrivers) { theDrivers.remove(driver); } }
/** * Tries to find a driver that can interpret the supplied URL. * * @param url * the URL of a database. * @return a {@code Driver} that matches the provided URL. {@code null} if * no {@code Driver} understands the URL * @throws SQLException * if there is any kind of problem accessing the database. */ public static Driver getDriver(String url) throws SQLException { ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { /* * Loop over the drivers in the DriverSet checking to see if one * does understand the supplied URL - return the first driver which * does understand the URL */ for (Driver driver : theDrivers) { if (driver.acceptsURL(url) && DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { return driver; } } } // If no drivers understand the URL, throw an SQLException // SQLState: 08 - connection exception // 001 - SQL-client unable to establish SQL-connection throw new SQLException("No suitable driver", "08001"); }
/** * Tries to find a driver that can interpret the supplied URL. * * @param url * the URL of a database. * @return a {@code Driver} that matches the provided URL. {@code null} if * no {@code Driver} understands the URL * @throws SQLException * if there is any kind of problem accessing the database. */ public static Driver getDriver(String url) throws SQLException { ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { /* * Loop over the drivers in the DriverSet checking to see if one * does understand the supplied URL - return the first driver which * does understand the URL */ for (Driver driver : theDrivers) { if (driver.acceptsURL(url) && DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { return driver; } } } // If no drivers understand the URL, throw an SQLException // SQLState: 08 - connection exception // 001 - SQL-client unable to establish SQL-connection throw new SQLException("No suitable driver", "08001"); }
/** * Tries to find a driver that can interpret the supplied URL. * * @param url * the URL of a database. * @return a {@code Driver} that matches the provided URL. {@code null} if * no {@code Driver} understands the URL * @throws SQLException * if there is any kind of problem accessing the database. */ public static Driver getDriver(String url) throws SQLException { ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { /* * Loop over the drivers in the DriverSet checking to see if one * does understand the supplied URL - return the first driver which * does understand the URL */ for (Driver driver : theDrivers) { if (driver.acceptsURL(url) && DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { return driver; } } } // If no drivers understand the URL, throw an SQLException // SQLState: 08 - connection exception // 001 - SQL-client unable to establish SQL-connection throw new SQLException("No suitable driver", "08001"); }
/** * Tries to find a driver that can interpret the supplied URL. * * @param url * the URL of a database. * @return a {@code Driver} that matches the provided URL. {@code null} if * no {@code Driver} understands the URL * @throws SQLException * if there is any kind of problem accessing the database. */ public static Driver getDriver(String url) throws SQLException { ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { /* * Loop over the drivers in the DriverSet checking to see if one * does understand the supplied URL - return the first driver which * does understand the URL */ for (Driver driver : theDrivers) { if (driver.acceptsURL(url) && DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { return driver; } } } // If no drivers understand the URL, throw an SQLException // SQLState: 08 - connection exception // 001 - SQL-client unable to establish SQL-connection throw new SQLException("No suitable driver", "08001"); }
/** * Tries to find a driver that can interpret the supplied URL. * * @param url * the URL of a database. * @return a {@code Driver} that matches the provided URL. {@code null} if * no {@code Driver} understands the URL * @throws SQLException * if there is any kind of problem accessing the database. */ public static Driver getDriver(String url) throws SQLException { ClassLoader callerClassLoader = VMStack.getCallingClassLoader(); synchronized (theDrivers) { /* * Loop over the drivers in the DriverSet checking to see if one * does understand the supplied URL - return the first driver which * does understand the URL */ for (Driver driver : theDrivers) { if (driver.acceptsURL(url) && DriverManager.isClassFromClassLoader(driver, callerClassLoader)) { return driver; } } } // If no drivers understand the URL, throw an SQLException // SQLState: 08 - connection exception // 001 - SQL-client unable to establish SQL-connection throw new SQLException("No suitable driver", "08001"); }