这是我第一次收到这个错误。
这段代码基本上获取了特定日期销售的每个商品的总数。
有解决这个问题的任何提示吗?谢谢。
Statement statement = connection.createStatement();
String query = "SELECT itemcode, SUM(quantity) AS 'Total Sales Per Day' "
+ "FROM sales "
+ "WHERE real_pur_date = '" + date + "' "
+ "GROUP BY itemcode ";
ResultSet rs = statement.executeQuery( query ); // this line gets the error / exception
while( rs.next() ){
Vector row = new Vector();
row.add( rs.getString( "itemcode" ) );
row.add( rs.getInt( "Total Sales Per Day" ) );
dailyData.add( row );
}
statement.close();
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
at com.mysql.jdbc.Util.handleNewInstance(Util.java:431)
at com.mysql.jdbc.ResultSetImpl.getInstance(ResultSetImpl.java:383)
at com.mysql.jdbc.MysqlIO.buildResultSetWithRows(MysqlIO.java:3140)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:491)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3118)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2288)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2709)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2627)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1556)
at posinventory.Controller.StatisticEngine.getDailyData(StatisticEngine.java:20)
at posinventory.Statistic.refreshTableDailyStat(Statistic.java:36)
at posinventory.Statistic.refreshTableDailyStat(Statistic.java:37)
at posinventory.Statistic.refreshTableDailyStat(Statistic.java:37)
at posinventory.Statistic.refreshTableDailyStat(Statistic.java:37)
Vector
。 - Alex Lockwood