예제 #1
0
  protected Connection getSQLConnection(RDBMSConnection connectionObj)
      throws ClassNotFoundException, SQLException {
    AbstactDialect dialect = getDialect(connectionObj);
    if (dialect == null) return null;

    Class.forName(dialect.getDriverClassName());
    return DriverManager.getConnection(
        connectionObj.getJdbcUrl(),
        connectionObj.getLoginUsername(),
        connectionObj.getLoginPassword());
  }
예제 #2
0
  protected ResultSet getValues(
      RDBMSInformationTarget rdbmsInformationTarget, Statement statement, String identifier)
      throws SQLException {
    AbstactDialect dialect = getDialect(rdbmsInformationTarget);
    if (dialect == null) return null;

    String query =
        "SELECT "
            + dialect.getSQLColumnNamePrefix()
            + rdbmsInformationTarget.getColumnName()
            + dialect.getSQLColumnNameSuffix();

    if (identifier != null)
      query +=
          "," + dialect.getSQLColumnNamePrefix() + identifier + dialect.getSQLColumnNameSuffix();

    query +=
        " FROM "
            + dialect.getSQLTableNamePrefix()
            + rdbmsInformationTarget.getTableName()
            + dialect.getSQLTableNameSuffix();

    statement.executeQuery(query);
    try {
      return statement.getResultSet();
    } catch (Exception e) {
      logger.error("Error occured when getting result set", e);
      return null;
    }
  }