java eas bos 查询结果集几种方式

1.

 IQueryExecutor query = new QueryExecutor("具体的query对象",context对象);
IRowSet rs = query.executeQuery(); 

    IRowSet 为金蝶的rowset 和java中一样

 

 

2.jdbc  我就不多说啦

 

 

 

3.apusic 提供的 datasource    

java的jdni 方式  结合使用 

 首先要在apusic 上配置数据源名称  地址 http:ip:6888/admin

  创建InitialContext对象
		javax.naming.Context context = null;
		try {
			context = new InitialContext();
		} catch (NamingException e) {
			e.printStackTrace();
			logger.error(e.getMessage());
			throw new BOSException(e);
		}
		// 通过JNDI取得数据源
		DataSource datasource = null;
		try {
			datasource = (DataSource) context.lookup(system);
		} catch (NamingException e) {
			e.printStackTrace();
			logger.error(e.getMessage());
			throw new BOSException(e);
		}
		// 通过数据源获取数据库连接
		try {
			conn = datasource.getConnection();
		} catch (SQLException e) {
			e.printStackTrace();
			logger.error(e.getMessage());
			throw new BOSException(e);
		}

  conn 就是  数据库的 Connection 

 

 

猜你喜欢

转载自j1a1v1a1.iteye.com/blog/2346302