Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access 7.0.011
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Cobol 4.0.011
  HXTT DBF 7.0.011
  HXTT Excel 6.0.012
  HXTT Paradox 7.0.011
  HXTT PDF 1.1.011
  HXTT Text(CSV) 7.0.011
  HXTT Word 1.0.009
  HXTT XML 3.0.011
Offshore Outsourcing
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)

HXTT ACCESS
ClassCastException: referential integrity
Benjamin Böttcher
2016-02-26 05:33:15.0
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.
Re:ClassCastException: referential integrity
HXTT Support
2016-02-26 08:15:46.0
Thanks. Supported. Please redownload it.

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap