java,返回多类型数组

 

xmlrpc 返回object多类型数组

public Object database(int id) { Object[][] rowData=new Object[5][]; String html=new String(); try { // The newInstance() call is a work around for some // broken Java implementations Class.forName("org.postgresql.Driver").newInstance(); } catch (Exception E) { //out.println("Unable to load driver."); E.printStackTrace(); } try{ Connection Conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/te st?user=iuser&password=iabc"); Statement Stmt = Conn.createStatement(); int sum=(id-1)*2; ResultSet RS = Stmt.executeQuery("select * from users "+ " order by id OFFSET "+id+" limit 5 "); int i=-1; while (RS.next()) { i++; rowData[i]=new Object[3]; rowData[i][0]=RS.getInt(1); rowData[i][1]=RS.getString(2); rowData[i][2]=RS.getString(3); } RS.close(); Stmt.close(); Conn.close(); } catch (SQLException E) { E.getMessage();E.getSQLState();E.getErrorCode(); } return rowData; }  

 

你可能感兴趣的:(java,返回多类型数组)