Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Cobol v2.1
  HXTT DBF v5.2
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
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
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan 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
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap