コード例 #1
0
  @Override
  public ConnectionImpl connect(String url, Properties info) throws SQLException {
    ConnectionType conn = JDBCURL.acceptsUrl(url);
    if (conn == null) {
      return null;
    }
    if (info == null) {
      // create a properties obj if it is null
      info = new Properties();
    } else {
      // don't modify the original
      info = PropertiesUtils.clone(info);
    }
    parseURL(url, info);

    ConnectionImpl myConnection = null;

    /*
     * Add the teiid server version to the properties
     */
    info.setProperty(ITeiidServerVersion.TEIID_VERSION_PROPERTY, getTeiidVersion().toString());

    try {
      myConnection = socketProfile.connect(url, info);
    } catch (SQLException e) {
      logger.log(Level.SEVERE, "Could not create connection", e); // $NON-NLS-1$
      throw e;
    }

    // logging
    String logMsg = Messages.getString(Messages.JDBC.Connection_success);
    logger.fine(logMsg);

    return myConnection;
  }
コード例 #2
0
  @Override
  public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
    if (info == null) {
      info = new Properties();
    } else {
      info = PropertiesUtils.clone(info);
    }

    // construct list of driverPropertyInfo objects
    List<DriverPropertyInfo> driverProps = new LinkedList<DriverPropertyInfo>();

    parseURL(url, info);

    for (String property : JDBCURL.KNOWN_PROPERTIES.keySet()) {
      DriverPropertyInfo dpi = new DriverPropertyInfo(property, info.getProperty(property));
      if (property.equals(TeiidURL.JDBC.VDB_NAME)) {
        dpi.required = true;
      }
      driverProps.add(dpi);
    }

    // create an array of DriverPropertyInfo objects
    DriverPropertyInfo[] propInfo = new DriverPropertyInfo[driverProps.size()];

    // copy the elements from the list to the array
    return driverProps.toArray(propInfo);
  }