hi,
i can not load data from my excel file cause following error. The demo excel file i will send you via mail.
java.sql.SQLException: Failed to go Rowid 21 of table Abwesenheit:There're only row 28 but you wish to get row 29.
at com.hxtt.global.SQLState.setNextException(Unknown Source)
at com.hxtt.sql.excel.b1.a(Unknown Source)
at com.hxtt.sql.dt.a(Unknown Source)
at com.hxtt.sql.ck.a(Unknown Source)
at com.hxtt.sql.ck.a(Unknown Source)
at com.hxtt.sql.af.y(Unknown Source)
at com.hxtt.sql.d1.a(Unknown Source)
at com.hxtt.sql.d1.a(Unknown Source)
at com.hxtt.sql.de.try(Unknown Source)
at com.hxtt.sql.de.next(Unknown Source)
at HTXX_Excel.main(HTXX_Excel.java:18)
thx!
best regards,
|
Checked.
select * from "Excel_Demo_2".Abwesenheit
will recur your issue.
It happened because your sheet information is 29 rows, but it's 28 rows in fact.
You should use MS Excel to open it, then save simply it without any modification. Then you can use HXTT Excel to query it.
|
Sorry for imprecise description. You can reproduce this issue like following:
1. insert new record
2. remove the new record
3. execute the select statement
That is a bug of driver when you try execute following code. The new demo excel file i will send you via mail.
thx!
best regards,
-------------------------------------------------------------------------
public static void main(String[] args) {
try {
Class.forName("com.hxtt.sql.excel.ExcelDriver");
Connection conn = DriverManager.getConnection("jdbc:excel:/Excel_Demo_Urlaub.xls?maxScanRows=0&caseInsentive=true&delayedClose=0");
String insert = "INSERT INTO \"Excel_Demo_Urlaub\".\"Abwesenheit\" (Beginn, Ende, ID, Personalnummer, Typ) VALUES (?, ?, ?, ?, ?)";
PreparedStatement stmt1 = conn.prepareStatement(insert);
int colCounter = 1;
stmt1.setDate(colCounter++, new Date(2015,11,30));
stmt1.setDate(colCounter++, new Date(2015,12,05));
stmt1.setDouble(colCounter++, 21.0);
stmt1.setDouble(colCounter++,1017.0);
stmt1.setString(colCounter++,"Urlaub");
stmt1.execute();
stmt1.close();
String delete = "DELETE FROM \"Excel_Demo_Urlaub\".\"Abwesenheit\" WHERE ID = ?";
PreparedStatement stmt2 = conn.prepareStatement(delete);
colCounter = 1;
stmt2.setDouble(colCounter++, 21.0);
stmt2.execute();
stmt2.close();
String query ="\r\n" +
"select \r\n" +
"Abwesenheit.\"Beginn\" ID25405,\r\n" +
"Abwesenheit.\"Ende\" ID25408,\r\n" +
"Abwesenheit.\"ID\" ID25411,\r\n" +
"Abwesenheit.\"Personalnummer\" ID25414,\r\n" +
"Abwesenheit.\"Typ\" ID25417\r\n" +
" from \r\n" +
"\"Excel_Demo_Urlaub\".\"Abwesenheit\" Abwesenheit\r\n" +
" where 1=1 and \r\n" +
"(((((Abwesenheit.\"Personalnummer\" in (1000.0,1001.0,1002.0,1003.0,1004.0,1005.0,1006.0,1007.0,1008.0,1009.0,1010.0,1011.0,1012.0,1013.0,1014.0,1015.0,1016.0,1017.0,1018.0,1019.0))))))";
Statement stmt = conn.createStatement();
ResultSet resultSet = stmt.executeQuery(query);
resultSet.getMetaData();
while (resultSet.next()) {
System.out.println("-------------------------------------");
for(int i = 1; i < 5; i++){
System.out.println(resultSet.getObject(i));
}
}
resultSet.close();
stmt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
|
Supported. Please download the latest package.
|
hi,
thx for the new version! It workts fine now.
best regards,
gtt
|