Package java.sql

Examples of java.sql.Driver


    protected void clearReferences() {

        // Unregister any JDBC drivers loaded by this classloader
        Enumeration drivers = DriverManager.getDrivers();
        while (drivers.hasMoreElements()) {
            Driver driver = (Driver) drivers.nextElement();
            if (driver.getClass().getClassLoader() == this) {
                try {
                    DriverManager.deregisterDriver(driver);
                } catch (SQLException e) {
                    log.warn("SQL driver deregistration failed", e);
                }
View Full Code Here


  {
    URL jarURL = new File(jarFileName).toURI().toURL();
   
        try {
            URLClassLoader classLoader = new URLClassLoader( new URL[]{jarURL} );
            Driver driver = (Driver)classLoader.loadClass(driverName).newInstance();
            System.out.println(driver);
            System.out.println("v"+driver.getMajorVersion()+"."+driver.getMinorVersion());
            System.out.println(driver.acceptsURL("jdbc:hsqldb:http://10.0.0.9/logger"));
           
            driver = new JDBCDriverWrapper(driver);
            DriverManager.registerDriver (driver);
        }
        catch(Exception e)
View Full Code Here

                else
                {
                    shutDownURI = connectURI+";shutdown=true";
                }
                Class dc = Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
                Driver driver = (Driver)dc.newInstance();               
                Properties info = new Properties();
                info.put( "user", user );
                info.put( "password", password );
               
                driver.connect(shutDownURI, info);
            }

        }
     catch (SQLException e)  {
        if ( driverName.equals("org.apache.derby.jdbc.EmbeddedDriver") && (e.getSQLState().equals("XJ015") ||  e.getSQLState().equals("08006"))) {
View Full Code Here

                Debug.logError("Problems with pool settings [time-between-eviction-runs-millis], using default of 600000.", module);
                timeBetweenEvictionRunsMillis = 600000;
            }

            // load the driver
            Driver jdbcDriver;
            try {
                jdbcDriver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).newInstance();
            } catch (Exception e) {
                Debug.logError(e, module);
                throw new GenericEntityException(e.getMessage(), e);
View Full Code Here

                Debug.logError("Problems with pool settings [time-between-eviction-runs-millis], using default of 600000.", module);
                timeBetweenEvictionRunsMillis = 600000;
            }

            // load the driver
            Driver jdbcDriver;
            try {
                jdbcDriver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).newInstance();
            } catch (Exception e) {
                Debug.logError(e, module);
                throw new GenericEntityException(e.getMessage(), e);
View Full Code Here

        planView.include(renderRequest, renderResponse);
    }

    private static String attemptConnect(PortletRequest request, PoolData data) throws SQLException, IllegalAccessException, InstantiationException {
        Class driverClass = attemptDriverLoad(request, data);
        Driver driver = (Driver) driverClass.newInstance();
        if(driver.acceptsURL(data.url)) {
            Properties props = new Properties();
            if(data.user != null) {
                props.put("user", data.user);
            }
            if(data.password != null) {
                props.put("password", data.password);
            }
            Connection con = null;
            try {
                con = driver.connect(data.url, props);
                final DatabaseMetaData metaData = con.getMetaData();
                return metaData.getDatabaseProductName()+" "+metaData.getDatabaseProductVersion();
            } finally {
                if(con != null) try{con.close();}catch(SQLException e) {}
            }
View Full Code Here

        planView.include(renderRequest, renderResponse);
    }

    private static String attemptConnect(PortletRequest request, PoolData data) throws SQLException, IllegalAccessException, InstantiationException {
        Class driverClass = attemptDriverLoad(request, data);
        Driver driver = (Driver) driverClass.newInstance();
        if (driver.acceptsURL(data.url)) {
            Properties props = new Properties();
            if (data.user != null) {
                props.put("user", data.user);
            }
            if (data.password != null) {
                props.put("password", data.password);
            }
            Connection con = null;
            try {
                con = driver.connect(data.url, props);
                final DatabaseMetaData metaData = con.getMetaData();
                return metaData.getDatabaseProductName() + " " + metaData.getDatabaseProductVersion();
            } finally {
                if (con != null) {
                    try {
View Full Code Here

        planView.include(renderRequest, renderResponse);
    }

    private static String attemptConnect(PortletRequest request, PoolData data) throws SQLException, IllegalAccessException, InstantiationException {
        Class driverClass = attemptDriverLoad(request, data);
        Driver driver = (Driver) driverClass.newInstance();
        if(driver.acceptsURL(data.url)) {
            Properties props = new Properties();
            if(data.user != null) {
                props.put("user", data.user);
            }
            if(data.password != null) {
                props.put("password", data.password);
            }
            Connection con = null;
            try {
                con = driver.connect(data.url, props);
                final DatabaseMetaData metaData = con.getMetaData();
                return metaData.getDatabaseProductName()+" "+metaData.getDatabaseProductVersion();
            } finally {
                if(con != null) try{con.close();}catch(SQLException e) {}
            }
View Full Code Here

        if (url == null || url.length() == 0) {
            LOGGER.error("No JDBC URL specified for the database.", url);
            return null;
        }

        Driver driver;
        try {
            driver = DriverManager.getDriver(url);
        } catch (final SQLException e) {
            LOGGER.error("No matching driver found for database URL [" + url + "].", e);
            return null;
View Full Code Here

    /*
      If an exit was requested, then we will be shutting down.
     */
    if (ijParser.exit || (initialFileInput && !mtUse)) {
      Driver d = null;
      try {
          d = DriverManager.getDriver("jdbc:derby:");
      } catch (Throwable e) {
        d = null;
      }
View Full Code Here

TOP

Related Classes of java.sql.Driver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.