While evaluating the HXTT Access driver I got following exception:
java.lang.ClassCastException: java.lang.Integer cannot be cast to com.hxtt.sql.ce
at com.hxtt.sql.r.a(Unknown Source)
at com.hxtt.sql.cu.a(Unknown Source)
at com.hxtt.sql.a4.a(Unknown Source)
at com.hxtt.sql.d1.a(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 test.AccessTest.testSQL(AccessTest.java:16)
...
I have an access database with following two tables:
Table A
- id Long Integer AUTO_INCREMENT
- name Short Text
Table B
- id Long Integer AUTO_INCREMENT
- name Short Text
- fkA Long Integer - FOREIGN KEY ON A(id) with activated referential integrity
I want to use hibernate for fetching and updating the data, but I could reproduce it with following simplified query without hibernate: select b.id, b.fkA, b.name from B b cross join A a where b.fkA=a.id;
Here my test class:
##########################################
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.junit.Test;
public class AccessTest {
@Test
public void testSQL() throws SQLException {
String sql = "select b.id, b.fkA, b.name from B b cross join A a where b.fkA=a.id;";
Connection con = DriverManager.getConnection("jdbc:access://target/test-classes/test.accdb", "", "");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
for (int i = 0; i < rs.getMetaData().getColumnCount(); i++) {
System.out.print(rs.getString(i + 1));
System.out.print(" - ");
}
System.out.println();
}
}
}
###############################################
Thanks for help.
|
Thanks. Supported. Please redownload it.
|