我尝试从SQLite数据库检索数据时出现错误。来自SQLite的Java数据解析错误
它检索数据的第一行到表,但是当该日期是有它给出以下所示的错误。
这是我得到错误的代码。
try {
con = DriverManager.getConnection("jdbc:sqlite:Rooms.db");
con.setAutoCommit(false);
pst = con.prepareStatement("Select * from Standard");
rs = pst.executeQuery();
while (rs.next())
{
LocalDate sD = null;
LocalDate eD = null;
if (rs.getDate(6) != null)
{
sD = Conv(rs.getDate(6));
eD = Conv(rs.getDate(7));
System.out.println(sD + " " + eD);
if (chkIn.getValue().isBefore(sD) == true && chkOut.getValue().isBefore(eD) == true)
{
datas.add(new StandardRoomList(rs.getString(1), rs.getString(2) , "£" + (rs.getInt(3)*pri), "" + rs.getInt(4)));
}
}
这是我收到的错误:
Caused by: java.text.ParseException: Unparseable date: "2017-11-17" does not match (\p{Nd}++)\Q-\E(\p{Nd}++)\Q-\E(\p{Nd}++)\Q \E(\p{Nd}++)\Q:\E(\p{Nd}++)\Q:\E(\p{Nd}++)\Q.\E(\p{Nd}++)
at org.sqlite.date.FastDateParser.parse(FastDateParser.java:299)
at org.sqlite.date.FastDateFormat.parse(FastDateFormat.java:490)
at org.sqlite.jdbc3.JDBC3ResultSet.getDate(JDBC3ResultSet.java:293)
... 64 more
2017-11-17
DaBoss