Пример #1
0
        /// <summary>
        /// Registers the given driver with the {@code DriverManager}.
        /// A newly-loaded driver class should call
        /// the method {@code registerDriver} to make itself
        /// known to the {@code DriverManager}. If the driver is currently
        /// registered, no action is taken.
        /// </summary>
        /// <param name="driver"> the new JDBC Driver that is to be registered with the
        ///               {@code DriverManager} </param>
        /// <exception cref="SQLException"> if a database access error occurs </exception>
        /// <exception cref="NullPointerException"> if {@code driver} is null </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static synchronized void registerDriver(java.sql.Driver driver) throws SQLException
        public static void RegisterDriver(java.sql.Driver driver)
        {
            lock (typeof(DriverManager))
            {
                RegisterDriver(driver, null);
            }
        }
Пример #2
0
        /// <summary>
        /// Registers the given driver with the {@code DriverManager}.
        /// A newly-loaded driver class should call
        /// the method {@code registerDriver} to make itself
        /// known to the {@code DriverManager}. If the driver is currently
        /// registered, no action is taken.
        /// </summary>
        /// <param name="driver"> the new JDBC Driver that is to be registered with the
        ///               {@code DriverManager} </param>
        /// <param name="da">     the {@code DriverAction} implementation to be used when
        ///               {@code DriverManager#deregisterDriver} is called </param>
        /// <exception cref="SQLException"> if a database access error occurs </exception>
        /// <exception cref="NullPointerException"> if {@code driver} is null
        /// @since 1.8 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static synchronized void registerDriver(java.sql.Driver driver, DriverAction da) throws SQLException
        public static void RegisterDriver(java.sql.Driver driver, DriverAction da)
        {
            lock (typeof(DriverManager))
            {
                /* Register the driver if it has not already been added to our list */
                if (driver != null)
                {
                    RegisteredDrivers.AddIfAbsent(new DriverInfo(driver, da));
                }
                else
                {
                    // This is for compatibility with the original DriverManager
                    throw new NullPointerException();
                }

                Println("registerDriver: " + driver);
            }
        }
Пример #3
0
 public void DeregisterDriver(java.sql.Driver driver)
 {
     java.sql.DriverManager.deregisterDriver(driver);
 }