Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v7.1
  HXTT Cobol v5.0
  HXTT DBF v7.1
  HXTT Excel v6.1
  HXTT Json v1.0
  HXTT Paradox v7.1
  HXTT PDF v2.0
  HXTT Text(CSV) v7.1
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Word v1.1
  HXTT XML v4.0
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 Text(CSV)
Hibernate and HXTT Text Driver
James Frankman
2006-06-05 12:24:49
I am currently evaluating the HXTT Text Driver because we have a need to read and process a text file. I am confused on how to map my class to the text file since the text file is not described by any DB. I know from your JDBC examples, you need to issue a "CREATE TABLE" statement to define the layout of the text file you need to manipulate. How is this sort of thing done with Hibernate?
Re:Hibernate and HXTT Text Driver
HXTT Support
2006-06-05 19:28:23
First, download HXTT Hibernate Support Package.
Second, please read CREATE TABLE sql. If you're using CSV or TSV table, you needn't even to define CREATE TABLE.
Thirdly, please read connection property table at Connecting to the Database. For instance, you can use jdbc:text:////yourTextFileDirectory?schemaFile=aSchemaFile.sql;fileExtension=TXT . If you stored all "CREATE TABLE" sqls in that aSchemaFile.sql file, HXTT Text (CSV) will load those table declaration sqls .

Re:Re:Hibernate and HXTT Text Driver
jfrankman
2006-06-06 10:01:05
I created "aSchemaFile.sql" and added it to the connection url as follows:

String url = "jdbc:Text:/.?schemaFile=aSchemaFile.sql;fileExtension=idx";
Connection con = DriverManager.getConnection(url, "", "");
Statement stmt = con.createStatement();
stmt.setFetchSize(10);
String sql="select * from \"KeyPayChecks.idx\"";
ResultSet rs = stmt.executeQuery(sql);

However when I do this I get the following stack trace:

java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at com.hxtt.sql.text.l.b(Unknown Source)
at com.hxtt.sql.text.l.void(Unknown Source)
at com.hxtt.sql.text.b.a(Unknown Source)
at com.hxtt.sql.text.b.a(Unknown Source)
at com.hxtt.sql.text.e.a(Unknown Source)
at com.hxtt.sql.be.if(Unknown Source)
at com.hxtt.sql.cx.a(Unknown Source)
at com.hxtt.sql.cx.a(Unknown Source)
at com.hxtt.sql.be.a(Unknown Source)
at com.hxtt.sql.be.a(Unknown Source)
at com.hxtt.sql.ab.a(Unknown Source)
at com.hxtt.sql.ab.a(Unknown Source)
at com.hxtt.sql.ab.executeQuery(Unknown Source)
at com.idfbins.keybank.ImageIndexFileServices.getRecords(ImageIndexFileServices.java:94)
at com.idfbins.keybank.Tester.main(Tester.java:15)
java.sql.SQLException: java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at com.hxtt.sql.text.l.b(Unknown Source)
at com.hxtt.sql.text.l.void(Unknown Source)
at com.hxtt.sql.text.b.a(Unknown Source)
at com.hxtt.sql.text.b.a(Unknown Source)
at com.hxtt.sql.text.e.a(Unknown Source)
at com.hxtt.sql.be.if(Unknown Source)
at com.hxtt.sql.cx.a(Unknown Source)
at com.hxtt.sql.cx.a(Unknown Source)
at com.hxtt.sql.be.a(Unknown Source)
at com.hxtt.sql.be.a(Unknown Source)
at com.hxtt.sql.ab.a(Unknown Source)
at com.hxtt.sql.ab.a(Unknown Source)
at com.hxtt.sql.ab.executeQuery(Unknown Source)
at com.idfbins.keybank.ImageIndexFileServices.getRecords(ImageIndexFileServices.java:94)
at com.idfbins.keybank.Tester.main(Tester.java:15)


at com.hxtt.global.SQLState.SQLException(Unknown Source)
at com.hxtt.sql.be.a(Unknown Source)
at com.hxtt.sql.ab.a(Unknown Source)
at com.hxtt.sql.ab.a(Unknown Source)
at com.hxtt.sql.ab.executeQuery(Unknown Source)
at com.idfbins.keybank.ImageIndexFileServices.getRecords(ImageIndexFileServices.java:94)
at com.idfbins.keybank.Tester.main(Tester.java:15)
0
Re:Re:Re:Hibernate and HXTT Text Driver
HXTT Support
2006-06-06 20:01:40
That issue was resulted by an invalid default value in your Create Table sql. Supported. Please download the latest package.

If possible, please paste your Create Table sql.
Re:Re:Re:Re:Hibernate and HXTT Text Driver
james frankman
2006-06-07 06:33:37
You are correct, I was off by one character in the definitions and there was some junk at the end of the sql file I had to delete. Once I found this, it has been working correctly. Thanks for your help.

P.S. It would be nice if a "SQL not valid" exception was thrown when this sort of thing happens. The "array Index out of bounds" is really reporting the effect of the error not the cause.
Re:Re:Re:Re:Re:Hibernate and HXTT Text Driver
HXTT Support
2006-06-07 06:41:03
Yeah. So the latest package will stuff/truncate that invalid default value without ArrayIndexOutOfBoundsException.

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