一个Eclipse获取Mysql数据的小问题

获取数据一直获取不上。之前用的C语言写的算法,想要写进Eclipse中,大家看看有什么问题,数据库连接一切正常
try {
Connection connect = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/financehelper","root","123456");

  System.out.println("Success connect Mysql server!");
  Statement stmt = connect.createStatement();

  ResultSet rs = stmt.executeQuery("select * from user_finaproduct");
  C_node[][]  C = new C_node[100][100]; 
  L_node[][]  L = new L_node[100][100];
  D_node[] D = new D_node[100]; 
  int i = 1;

while (rs.next()) {
D[i].item[1] = rs.getInt("sex");
D[i].item[2] = rs.getInt("stage");
D[i].item[3] = rs.getInt("moneytype");
D[i].item[4] = rs.getInt("income");
D[i].item[5] = rs.getInt("outcome");
D[i].item[6] = rs.getInt("save");
D[i].item[7] = rs.getInt("worktype");
D[i].item[8] = rs.getInt("product1");
String temp = rs.getInt("product2")+"";
if(!temp.equals(""))
D[i].item[9] = rs.getInt("product2");
temp = rs.getInt("product3")+"";
if(!temp.equals(""))
D[i].item[10] = rs.getInt("product3");
i++;
System.out.println(D[i].item[1]);
}
}
catch (Exception e) {
System.out.print("get data error!");
e.printStackTrace();
}
}

D_NODE的类:class D_node {
int[] item=new int[100]; 

}
初学者,求大牛解答

问题出在while循环的第一行

http://blog.csdn.net/qq_34309305/article/details/66968584
java链接mysql实例

为了写数据挖掘算法方便,这些数据都是int型的

System.out.println("Success connect Mysql server!");
如果打印这一句,剩下的就是数据库数据表类型获取的问题了

如果是我,我就这么写接受类:

public class BookItem {

private String id;

private String name;

private String price;

private String number;

/**

* @return the id

*/

public String getId() {

return id;

}

/**

* @param id the id to set

*/

public void setId(String id) {

this.id = id;

}

/**

* @return the name

*/

public String getName() {

return name;

}

/**

* @param name the name to set

*/

public void setName(String name) {

this.name = name;

}

/**

* @return the price

*/

public String getPrice() {

return price;

}

/**

* @param price the price to set

*/

public void setPrice(String price) {

this.price = price;

}

/**

* @return the number

*/

public String getNumber() {

return number;

}

/**

* @param number the number to set

*/

public void setNumber(String number) {

this.number = number;

}

}

然后在while下面这样接收:
BookItem。setiid( rs.getInt("id"))