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


Java ResultSet.getString方法代码示例

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


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

示例1: classAdd

import java.sql.ResultSet; //导入方法依赖的package包/类
public void classAdd() {
	jComboBox1.removeAllItems();
	jComboBox1.addItem("��ѡ��༶");
	try {
		ResultSet rs = conn.getRs(
				"select * from tb_class where specName='" + String.valueOf(jComboBox5.getSelectedItem()) + "' ");
		while (rs.next()) {
			String zhy = rs.getString("className");
			jComboBox1.addItem(zhy);
		}
		rs.close();

	} catch (Exception e) {
		System.out.println(e);
	}
}
 
开发者ID:huihut,项目名称:stuManager,代码行数:17,代码来源:StudentInfoAddFrame.java

示例2: selectTriggerState

import java.sql.ResultSet; //导入方法依赖的package包/类
/**
 * <p>
 * Select a trigger' state value.
 * </p>
 * 
 * @param conn
 *          the DB Connection
 * @return the <code>{@link org.quartz.Trigger}</code> object
 */
public String selectTriggerState(Connection conn, TriggerKey triggerKey) throws SQLException {
    PreparedStatement ps = null;
    ResultSet rs = null;

    try {
        String state = null;

        ps = conn.prepareStatement(rtp(SELECT_TRIGGER_STATE));
        ps.setString(1, triggerKey.getName());
        ps.setString(2, triggerKey.getGroup());
        rs = ps.executeQuery();

        if (rs.next()) {
            state = rs.getString(COL_TRIGGER_STATE);
        } else {
            state = STATE_DELETED;
        }

        return state.intern();
    } finally {
        closeResultSet(rs);
        closeStatement(ps);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:StdJDBCDelegate.java

示例3: testAllProcedures

import java.sql.ResultSet; //导入方法依赖的package包/类
@Test
public void testAllProcedures() throws SQLException {
    ResultSet procedures =
            conn.getMetaData().getProcedures("blah", "blah", "%");
    int count = 0;
    List<String> names = Arrays.asList(new String[] {"ArbitraryDurationProc", 
    		"TPCCTestProc", "InsertOrders", "InsertWarehouse", "SelectOrders"});
    while (procedures.next()) {
        String procedure = procedures.getString("PROCEDURE_NAME");
        if (procedure.contains(".")) {
            // auto-generated CRUD
        } else {
            assertTrue(names.contains(procedure));
        }
        count++;
    }
    System.out.println("Procedure count is: " + count);
    assertEquals(5, count);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:TestJDBCDriver.java

示例4: transfer

import java.sql.ResultSet; //导入方法依赖的package包/类
public boolean transfer(int nColumnNumber1Based, ResultSet resultSetSource, PreparedStatement insertStatementInsert)
{
	try
	{			
		String csValue = resultSetSource.getString(m_nColSourceIndex);
		if (!resultSetSource.wasNull())
			insertStatementInsert.setString(m_nColSourceIndex, csValue);
		else
			insertStatementInsert.setNull(m_nColSourceIndex, Types.CHAR);
		return true;
	}
	catch (SQLException e)
	{
		e.printStackTrace();
	}
	return false;		
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:18,代码来源:RecordColTypeManagerChar.java

示例5: getAllPalab

import java.sql.ResultSet; //导入方法依赖的package包/类
public List<String> getAllPalab(){
    List<String> palab = new LinkedList<String>();
    String p;
    
    try{
        ResultSet rs;
        rs = stmt.executeQuery("SELECT clave FROM palabra ORDER BY clave");
        while (rs.next()){
            p = rs.getString("clave");
           palab.add(p);    
        }
    }
    catch(SQLException e){
        
    }
    return palab;
}
 
开发者ID:LetyM,项目名称:nihonGO,代码行数:18,代码来源:DatabaseHandler.java

示例6: getWarnTargetId

import java.sql.ResultSet; //导入方法依赖的package包/类
public String getWarnTargetId(int warnId) {
    try {
        PreparedStatement statement = connection.prepareStatement(SELECT_WARNING);
        statement.setInt(1, warnId);
        ResultSet set = statement.executeQuery();
        if (set.next()) {
            return set.getString("targetid");
        } else {
            return null;
        }
    } catch (SQLException e) {
        return null;
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:15,代码来源:WarningManager.java

示例7: getWarnReason

import java.sql.ResultSet; //导入方法依赖的package包/类
public String getWarnReason(int warnId) {
    try {
        PreparedStatement statement = connection.prepareStatement(SELECT_WARNING);
        statement.setInt(1, warnId);
        ResultSet set = statement.executeQuery();
        if (set.next()) {
            return set.getString("reason");
        } else {
            return null;
        }
    } catch (SQLException e) {
        return null;
    }
}
 
开发者ID:WheezyGold7931,项目名称:happybot,代码行数:15,代码来源:WarningManager.java

示例8: getPort

import java.sql.ResultSet; //导入方法依赖的package包/类
private String getPort() throws Exception {
    ResultSet rs = this.conn.createStatement().executeQuery("show variables like 'port'");
    assertTrue(rs.next());
    String port1 = rs.getString(2);
    rs.close();
    return port1;
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:8,代码来源:TestHABasics.java

示例9: Airport

import java.sql.ResultSet; //导入方法依赖的package包/类
/**
 * constructor with an ID
 */
public Airport(String aid){
    conn = DBConnect.connect();
    PreparedStatement pst = null;
    try {
        String sql = "SELECT * FROM `airport` WHERE `airportID`=?";
        pst = conn.prepareStatement(sql);
        pst.setString(1, aid);
        ResultSet rs;
        rs = pst.executeQuery();
        if (!rs.isBeforeFirst() ) {     
            return;
        }
        while(rs.next()){
            this.airportID = rs.getString("airportID");
            this.name = rs.getString("name");
            this.city = rs.getString("city");
            this.apstate = rs.getString("apstate");
            this.country = rs.getString("country");
            this.active = rs.getBoolean("active");
            this.exist = true;
        }
        
    } catch (SQLException e) {
        System.out.println("Error:"+e);
        
    }
}
 
开发者ID:YasasshraSolutions,项目名称:Java-Air-Reservation,代码行数:31,代码来源:Airport.java

示例10: extractData

import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public Map<Long, String> extractData(ResultSet resultSet) throws SQLException {
    Map<Long, String> result = new HashMap<>();
    while (resultSet.next()) {
        long id = resultSet.getLong("ID");
        String targetSpace = resultSet.getString("TARGET_SPACE");
        result.put(id, targetSpace);
        logger.debug(String.format("Retrieve data from row ID: '%s' and TARGET_SPACE: '%s'", id, targetSpace));
    }
    return result;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:12,代码来源:SplitTargetSpaceColumn.java

示例11: mapRecordToModel

import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
protected ObjectModel mapRecordToModel(final ResultSet resultSet) throws SQLException {
    final District district = new DistrictImpl(
            resultSet.getString("districtID"),
            resultSet.getString("districtLongName"),
            resultSet.getInt("population"));
    return district;
}
 
开发者ID:SofiaRosetti,项目名称:S3-16-d-rescue,代码行数:9,代码来源:DistrictDaoImpl.java

示例12: verifyExport

import java.sql.ResultSet; //导入方法依赖的package包/类
public void verifyExport(DATATYPES dt, String[] data) throws SQLException {
  LOG.info("Verifying export: " + getTableName());
  // Check that we got back the correct number of records.
  Connection conn = getManager().getConnection();

  PreparedStatement statement = conn.prepareStatement("SELECT "
      + getColName() + " FROM " + getTableName(dt),
      ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
  System.out.println("data samples being compared : " + data.length);

  ResultSet rs = null;
  try {
    rs = statement.executeQuery();
    int cnt = 0;
    try {
      while (rs.next()) {
        String tmp = rs.getString(1);
        String expected = data[cnt++];
        System.out.println("Readback, expected" + tmp + " :"
            + expected);
        if (tmp == null) {
          assertNull("Must be null", expected);
        } else {
          assertEquals("Data must match", expected, tmp);
        }
      }
      System.out.println("expected samples : " + data.length
          + " Actual samples : " + cnt);
      assertEquals("Resultset must contain expected samples",
          data.length, cnt);
    } finally {

      rs.close();
    }
  } finally {
    statement.close();
  }

}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:40,代码来源:ManagerCompatExport.java

示例13: getDatabaseConfig

import java.sql.ResultSet; //导入方法依赖的package包/类
/**
 * 获得数据库连接
 * 
 * @return
 * @throws Exception
 */
public static List<DatabaseConfig> getDatabaseConfig() throws Exception {
	Connection conn = null;
	Statement stat = null;
	ResultSet rs = null;
	try {
		conn = getConnection();
		stat = conn.createStatement();
		rs = stat.executeQuery("select * from DBSet");
		List<DatabaseConfig> result = new ArrayList<DatabaseConfig>();
		while (rs.next()) {
			String name = rs.getString("name");
			String value = rs.getString("value");
			DatabaseConfig databaseConfig = JSON.parseObject(value, DatabaseConfig.class);
			databaseConfig.setConnName(name);
			result.add(databaseConfig);
		}

		return result;
	} finally {
		if (rs != null)
			rs.close();
		if (stat != null)
			stat.close();
		if (conn != null)
			conn.close();
	}
}
 
开发者ID:shenzhenMirren,项目名称:vertx-generator,代码行数:34,代码来源:ConfigUtil.java

示例14: test001

import java.sql.ResultSet; //导入方法依赖的package包/类
public void test001() throws Exception {
	if (BlancoSfdcJdbcTestConstants.isTestWithSfdc() == false)
		return;

	Class.forName("blanco.sfdc.jdbc.driver.BlancoSfdcJdbcDriver");
	try {
		final Properties prop = new Properties();
		final InputStream inStream = new FileInputStream("soqlro.properties");
		prop.load(new BufferedInputStream(inStream));
		inStream.close();

		final String url = prop.getProperty("url",
				"jdbc:blanco:sfdc:soqlro://login.salesforce.com/services/Soap/u/40.0");
		final String user = prop.getProperty("user", "NoUserSpesified");
		final String pass = prop.getProperty("password", "NoPassSpecified");

		final Connection conn = DriverManager.getConnection(url, user, pass);

		final String sql = "SELECT Id, Name, LastModifiedDate FROM Account";
		final PreparedStatement stmt = conn.prepareStatement(sql);

		stmt.setFetchSize(200);
		stmt.getFetchSize();

		final ResultSet rs = stmt.executeQuery();
		while (rs.next()) {
			final String id = rs.getString("id");
			final String name = rs.getString("name");
			final java.sql.Date lastModifiedDate = rs.getDate("lastmodifieddate");
			if (false)
				System.err.println("id: " + id + ", name:" + name + ", LastModifiedDate:" + lastModifiedDate);
		}
		rs.close();
		stmt.close();
		conn.close();
	} catch (SQLException ex) {
		ex.printStackTrace();
		fail();
	}
}
 
开发者ID:igapyon,项目名称:blanco-sfdc-jdbc-driver,代码行数:41,代码来源:BlancoSfdcJdbcPreparedStatementTest.java

示例15: getNullableResult

import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public String getNullableResult(ResultSet rs, int columnIndex)
        throws SQLException {
    return rs.getString(columnIndex);
}
 
开发者ID:Yanweichen,项目名称:MybatisGeneatorUtil,代码行数:6,代码来源:StringType2Handler.java


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