Package java.sql

Examples of java.sql.Driver


      System.err.println("usage: java -cp DriverInspector.jar:vendordriver.jar <driver classname>");
      System.exit(1);
    }
   
    Class<?> driverClass = Class.forName(args[0]);
    Driver d = (Driver)driverClass.newInstance();
   
    System.out.println("Driver class: "+d.getClass().getName());
    System.out.println("Driver Major Version: "+d.getMajorVersion());
    System.out.println("Driver Minor Version: "+d.getMinorVersion());   
  }
View Full Code Here


          ClassNotFoundException, MalformedURLException
  {
    unregisterSQLDriver(sqlDriver);
    sqlDriver.addPropertyChangeListener(_myDriverListener);
        SQLDriverClassLoader loader = new SQLDriverClassLoader(sqlDriver);
    Driver driver =
            (Driver)(Class.forName(sqlDriver.getDriverClassName(),
                                   false,
                                   loader).newInstance());
    _driverInfo.put(sqlDriver.getIdentifier(), driver);
    _classLoaders.put(sqlDriver.getIdentifier(), loader);
View Full Code Here

    if (pw != null)
    {
      myProps.put("password", pw);
    }

    Driver driver = _driverInfo.get(sqlDriver.getIdentifier());
    if (driver == null)
    {
            // TODO: Why shouldn't we call registerSQLDriver here? RMM 20070401
      s_log.debug("Loading driver that wasn't registered: " +
              sqlDriver.getDriverClassName());
      ClassLoader loader = new SQLDriverClassLoader(sqlDriver);
            driver = (Driver)(Class.forName(sqlDriver.getDriverClassName(),
                                            false,
                                            loader).newInstance());

    }
    Connection jdbcConn = driver.connect(alias.getUrl(), myProps);
    if (jdbcConn == null)
    {
      throw new SQLException(s_stringMgr.getString("SQLDriverManager.error.noconnection"));
    }
    return new SQLConnection(jdbcConn, props, sqlDriver);
View Full Code Here

      return getEasyMockSQLMetaData(dbName, dbURL, nice, true);
   }

   public static SQLDriverManager getEasyMockSQLDriverManager() {
      SQLDriverManager result = createMock(SQLDriverManager.class);
      Driver mockDriver = createMock(Driver.class);
      replay(mockDriver);
      expect(result.getJDBCDriver(isA(IIdentifier.class))).andReturn(mockDriver)
                                                          .anyTimes();
      replay(result);
      return result;
View Full Code Here

   private Connection getConnection() throws Exception
   {
      Connection conn = null;
      if (jdbcURL != null)
      {
         Driver driver = org.hsqldb.jdbcDriver.class.newInstance();
         Properties props = new Properties();
         props.put("user", "sa");
         conn = driver.connect(jdbcURL, props);
      }
      else
      {
         DataSource datasource = (DataSource) new InitialContext().lookup(getDataSourceJndiName());
         conn = datasource.getConnection();
View Full Code Here

   {
      if (datasource == null)
      {
         try
         {
            Driver driver = org.hsqldb.jdbcDriver.class.newInstance();
            String host = System.getProperty(DBSetupDelegate.DBADDRESS_PROPERTY, DBSetupDelegate.DEFAULT_ADDRESS);
            // JBAS-8540
            String jdbcURL = "jdbc:hsqldb:hsql://" + JBossTestUtil.fixHostnameForURL(host) + ":" + DBSetupDelegate.DEFAULT_PORT;
            datasource = new MockDataSource(driver, jdbcURL, "sa", null);
         }
View Full Code Here

     try
     {
       if(!useDataSource)
       {
         String url = getConnectionURL();
         Driver d = getDriver(url);
         con = d.connect(url, copy);
         if (con == null)
           throw new JBossResourceException("Wrong driver class for this connection URL");        
       }
       else
       {
View Full Code Here

          log.trace("Trying to create a connection to " + url);
        }
       Connection con = null;
         try
         {
           Driver d = getDriver(url);
           con = d.connect(url, copy);
           if(con == null)
           {
             log.warn("Wrong driver class for this connection URL: " + url);
         urlSelector.failedUrlObject(url);
           }
View Full Code Here

      log.error("JdbcLoggerDriver class not found!", exc);
      fail("JdbcLoggerDriver class not found! "+ exc.getMessage());
    }

    try {
      Driver driver = DriverManager.getDriver("jdbc:derby:");
      log.info(driver);
      assertNull("No registered driver should be in.", driver);
    }
    catch (Exception exc) {
      log.info(exc.getMessage());
View Full Code Here

        this.pool = pool;
        String driverClassname = pool.getDriver();
        try {
          Class driverClass = Class.forName(driverClassname);
          if (driverClass != null) {
            Driver driver = (Driver)driverClass.newInstance();
            DriverManager.registerDriver(driver);
            pool.getZone().log().info("JDBCFactory for pool '"+pool.getName()+"' initialized, driver=" + driverClass);
          }
        } catch (Exception exception) {
          pool.getZone().log().error("Couldn't initialize driver: " + driverClassname, exception);
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.