当前位置: 首页>>代码示例>>Java>>正文


Java Driver.acceptsURL方法代码示例

本文整理汇总了Java中java.sql.Driver.acceptsURL方法的典型用法代码示例。如果您正苦于以下问题:Java Driver.acceptsURL方法的具体用法?Java Driver.acceptsURL怎么用?Java Driver.acceptsURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.sql.Driver的用法示例。


在下文中一共展示了Driver.acceptsURL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findDriver

import java.sql.Driver; //导入方法依赖的package包/类
private Driver findDriver(String realUrl) throws SQLException {

    Driver wrappedDriver = null;
    for (Driver driver : registeredDrivers()) {
      try {
        if (driver.acceptsURL(realUrl)) {
          wrappedDriver = driver;
          break;
        }
      } catch (SQLException e) {
        // intentionally ignore exception
      }
    }
    if (wrappedDriver == null) {
      throw new SQLException("Unable to find a driver that accepts " + realUrl);
    }
    return wrappedDriver;
  }
 
开发者ID:opentracing-contrib,项目名称:java-jdbc,代码行数:19,代码来源:TracingDriver.java

示例2: getAllDriverInfos

import java.sql.Driver; //导入方法依赖的package包/类
public static DriverInfo[] getAllDriverInfos() {
    LinkedList predefinedDriverList = new LinkedList();
    Iterator driverList = getJDBCProperties().iterator();

    boolean accepted;
    DriverInfo predefinedInfo;
    while(driverList.hasNext()) {
        JDBCProperties drivers = (JDBCProperties)driverList.next();
        Enumeration driverArray = getAllDrivers();
        accepted = false;

        while(driverArray.hasMoreElements()) {
            Driver driver = (Driver)driverArray.nextElement();

            try {
                if(driver.acceptsURL(drivers.getUrlPrefix() + "localhost/test")) {
                    predefinedInfo = new DriverInfo(driver, drivers);
                    predefinedDriverList.add(predefinedInfo);
                    accepted = true;
                    break;
                }
            } catch (SQLException var7) {
                ;
            }
        }

        if(!accepted) {
            predefinedDriverList.add(new DriverInfo((Driver)null, drivers));
        }
    }

    LinkedList driverList1 = new LinkedList();
    Enumeration drivers1 = getAllDrivers();

    while(drivers1.hasMoreElements()) {
        Driver driverArray1 = (Driver)drivers1.nextElement();
        accepted = true;
        Iterator driver1 = predefinedDriverList.iterator();

        while(driver1.hasNext()) {
            predefinedInfo = (DriverInfo)driver1.next();
            if(predefinedInfo.getDriver() != null && predefinedInfo.getDriver().equals(driverArray1)) {
                accepted = false;
                break;
            }
        }

        if(accepted) {
            driverList1.add(new DriverInfo(driverArray1, (JDBCProperties)null));
        }
    }

    driverList1.addAll(predefinedDriverList);
    Collections.sort(driverList1);
    DriverInfo[] driverArray2 = new DriverInfo[driverList1.size()];
    driverList1.toArray(driverArray2);
    return driverArray2;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:59,代码来源:DatabaseService.java


注:本文中的java.sql.Driver.acceptsURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。