Mysql 我准备的声明没有具体说明

Mysql 我准备的声明没有具体说明,mysql,jdbc,prepared-statement,Mysql,Jdbc,Prepared Statement,我正在对数据库准备的语句进行查询,但结果不正确 我在打印对账单时出现此错误 com.mysql.jdbc。JDBC42PreparedStatement@157b62f9:从“2015-01-01”和“2015-01-25”之间的2015 wind中选择*,其中TimeStamp,以及(**未指定**)中的连接区域 10YAT-APG--L(我打印我的字符串,它会给我一个输出) 有人知道这是怎么回事吗 public List<Wind2015> getResultsWind(Stri

我正在对数据库准备的语句进行查询,但结果不正确

我在打印对账单时出现此错误

com.mysql.jdbc。JDBC42PreparedStatement@157b62f9:从“2015-01-01”和“2015-01-25”之间的
2015 wind
中选择*,其中
TimeStamp
,以及(**未指定**)中的
连接区域

10YAT-APG--L(我打印我的字符串,它会给我一个输出)

有人知道这是怎么回事吗

public List<Wind2015> getResultsWind(String beginDate1, String endDate1, String[] connectingAreas1) throws Exception{
    int count = 0;
    List<Wind2015> myWind2015s = new ArrayList<>();

    SimpleDateFormat readFormat = new SimpleDateFormat("EE MMM dd HH:mm:ss z yyyy",
            Locale.ENGLISH);
    Date date2 = readFormat.parse(beginDate1);
    Date date3 = readFormat.parse(endDate1);


    String beginDate = new SimpleDateFormat("yyyy-MM-dd").format(date2);
    String endDate = new SimpleDateFormat("yyyy-MM-dd").format(date3);

    ArrayList<String> connectingArea = new ArrayList<>(Arrays.asList(connectingAreas1));

    StringBuilder inputs = new StringBuilder();

    for (int i = 0; i < connectingArea.size(); i++) {
        if (i < connectingArea.size()-1) {
            inputs.append("?,");
        } else {
            inputs.append("?");
        }   
    }


    String connectingAreaInputs = inputs.toString();

    Connection connection = null;
    PreparedStatement prepareStatement = null;
    ResultSet myRs = null;

    System.out.println(connectingAreaInputs);

    try {
        connection = getConnection();

        String sql = "SELECT * FROM `2015-wind` WHERE `TimeStamp` BETWEEN ? AND ? AND `ConnectingArea` IN ("+ connectingAreaInputs +")";

        prepareStatement = connection.prepareStatement(sql);


        prepareStatement.setString(count+=1,beginDate);
        prepareStatement.setString(count+=1, endDate);

        System.out.println(prepareStatement);
        for (String string : connectingArea) {
             System.out.println(string);
            count+=1;
            prepareStatement.setString(count, string);
        }



        myRs = prepareStatement.executeQuery();

        Wind2015 wind2015 = null;

        while (myRs.next()) {

            String timeStamp = myRs.getString("Timestamp");
            String connectingArea1 = myRs.getString("ConnectingArea");
            String value = myRs.getString("ActualWindEnergy");

            wind2015 = new Wind2015(timeStamp, value, connectingArea1);

            myWind2015s.add(wind2015);
        }

        return myWind2015s;

    } finally {
        close(connection, prepareStatement, myRs);
    }

}
public List getResultsWind(字符串beginDate1、字符串endDate1、字符串[]ConnectionAreas1)引发异常{
整数计数=0;
List myWind2015s=new ArrayList();
SimpleDataFormat readFormat=新的SimpleDataFormat(“EE MMM dd HH:mm:ss z yyyy”,
语言环境(英语);
Date date2=readFormat.parse(beginDate1);
Date date3=readFormat.parse(endDate1);
字符串beginDate=新的SimpleDateFormat(“yyyy-MM-dd”).格式(日期2);
字符串endDate=新的SimpleDateFormat(“yyyy-MM-dd”)。格式(日期3);
ArrayList connectingArea=新的ArrayList(Arrays.asList(connectingAreas1));
StringBuilder输入=新的StringBuilder();
对于(int i=0;i
您正在使用以下行打印准备好的语句:

System.out.println(prepareStatement);
在(…)
表达式中为
中的动态占位符赋值之前,使它们(正确)显示为“尚未指定”


将print语句移动到它当前所在的for循环之后。

您正在使用此行打印准备好的语句:

System.out.println(prepareStatement);
在(…)
表达式中为
中的动态占位符赋值之前,使它们(正确)显示为“尚未指定”

将print语句移动到它当前所在的for循环之后