public static void createInstance(DataSetDesign dataSetDesign) {
    release();
    DataSourceDesign dataSourceDesign = dataSetDesign.getDataSourceDesign();
    Properties props = new Properties();
    try {
      props = DesignSessionUtil.getEffectiveDataSourceProperties(dataSourceDesign);
    } catch (OdaException e) {
      logger.log(Level.WARNING, e.getMessage(), e);
    }

    String userName = props.getProperty(Constants.ODAUser);
    String password = props.getProperty(Constants.ODAPassword);
    String url = props.getProperty(Constants.ODAURL);
    String driverClass = props.getProperty(Constants.ODADriverClass);

    // bidi_hcg: if Bidi format is defined - perform required Bidi transformations
    String metadataBidiFormatStr = props.getProperty(BidiConstants.METADATA_FORMAT_PROP_NAME);
    if (metadataBidiFormatStr != null) {
      userName =
          BidiTransform.transform(
              userName, BidiConstants.DEFAULT_BIDI_FORMAT_STR, metadataBidiFormatStr);
      password =
          BidiTransform.transform(
              password, BidiConstants.DEFAULT_BIDI_FORMAT_STR, metadataBidiFormatStr);
      url =
          BidiTransform.transformURL(
              url, BidiConstants.DEFAULT_BIDI_FORMAT_STR, metadataBidiFormatStr);
    }

    instance = new JdbcMetaDataProvider(driverClass, url, userName, password);
  }
示例#2
0
 public ResultSet getAlltables(String schemaPattern, String namePattern, String[] types) {
   if (connection == null) {
     try {
       reconnect();
     } catch (Exception e) {
       logger.log(Level.WARNING, e.getMessage(), e);
       return null;
     }
     try {
       return connection.getMetaData().getTables(getCatalog(), schemaPattern, namePattern, types);
     } catch (SQLException e) {
       logger.log(Level.WARNING, e.getMessage(), e);
       return null;
     } catch (Exception ex) {
       return null;
     }
   }
   try {
     return connection.getMetaData().getTables(getCatalog(), schemaPattern, namePattern, types);
   } catch (SQLException e) {
     try {
       reconnect();
       return connection.getMetaData().getTables(getCatalog(), schemaPattern, namePattern, types);
     } catch (SQLException ex) {
       logger.log(Level.WARNING, ex.getMessage(), ex);
       return null;
     } catch (OdaException ex) {
       logger.log(Level.WARNING, ex.getMessage(), ex);
       return null;
     }
   }
 }
示例#3
0
 public ResultSet getTableTypes() {
   if (connection == null) {
     try {
       reconnect();
     } catch (Exception e) {
       logger.log(Level.WARNING, e.getMessage(), e);
       return null;
     }
     try {
       return connection.getMetaData().getTableTypes();
     } catch (SQLException e) {
       logger.log(Level.WARNING, e.getMessage(), e);
       return null;
     } catch (Exception ex) {
       return null;
     }
   }
   try {
     return connection.getMetaData().getTableTypes();
   } catch (SQLException e) {
     try {
       reconnect();
       return connection.getMetaData().getTableTypes();
     } catch (SQLException ex) {
       logger.log(Level.WARNING, ex.getMessage(), ex);
       return null;
     } catch (OdaException ex) {
       logger.log(Level.WARNING, ex.getMessage(), ex);
       return null;
     }
   }
 }
示例#4
0
 public ResultSet getProcedureColumns(
     String schemaPattern, String procedureNamePattern, String columnNamePattern) {
   if (connection == null) {
     try {
       reconnect();
     } catch (Exception e) {
       logger.log(Level.WARNING, e.getMessage(), e);
       return null;
     }
     try {
       return connection
           .getMetaData()
           .getProcedureColumns(
               getCatalog(), schemaPattern, procedureNamePattern, columnNamePattern);
     } catch (SQLException e) {
       logger.log(Level.WARNING, e.getMessage(), e);
       return null;
     } catch (Exception ex) {
       return null;
     }
   }
   try {
     return connection
         .getMetaData()
         .getProcedureColumns(
             getCatalog(), schemaPattern, procedureNamePattern, columnNamePattern);
   } catch (SQLException e) {
     try {
       reconnect();
       return connection
           .getMetaData()
           .getProcedureColumns(
               getCatalog(), schemaPattern, procedureNamePattern, columnNamePattern);
     } catch (SQLException e1) {
       logger.log(Level.WARNING, e1.getMessage(), e1);
       return null;
     } catch (OdaException e1) {
       logger.log(Level.WARNING, e1.getMessage(), e1);
       return null;
     }
   }
 }