Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v6.0
  HXTT Cobol v3.0
  HXTT DBF v6.0
  HXTT Excel v5.0
  HXTT Paradox v6.0
  HXTT Text(CSV) v6.0
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT XML v2.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 Beijing City (abbr, HXTT)

HXTT Text(CSV)
TextDriver does not detect line endings of csv file automatically when delayedClose=0
Jos Brakenhoff
2017-04-24 02:59:00.0
I have a csv file with unix style line endings. When I read that in with the TextDriver in Windows, it reads the first record incorrectly. The first character of the first column is missing.

My csv file contains: (With just line feeds as end of line)

COLUMN
value

My code:

Class.forName("com.hxtt.sql.text.TextDriver");
String url = "jdbc:csv:/.?delayedClose=0;_CSV_Header=true";
String query = "select * from \"linux-eol.csv\"";
try(Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query)) {
resultSet.next();
System.out.println(resultSet.getString("COLUMN"));
}

The output is 'alue' in Windows.
In Linux, it outputs 'value'.

Notes:
- Removing delayedClose=0 solves the problem. However, this property seems unrelated to me, and should not influence the line ending detection.
- We previously used version 5.1.032, where this issue did not occur. We are now testing version 5.2.177, where this issue popped up.
Re:TextDriver does not detect line endings of csv file automatically when delayedClose=0
HXTT Support
2017-04-24 04:52:53.0
_CSV_EOL connection property: To specify 1~2 character sequence to terminate one line. An end-of-line line sequence is any one of a line feed ('\n', 0x0A), a carriage return ('\r', 0x0D), or a carriage return followed immediately by a linefeed. In most occasions, you needn't to care that connection property, since HXTT CSV supports even to mix three styles in one file. For data update, HXTT CSV can detect automatically OS version and choose the suitable EOL style in UNIX-style, DOS-style, and Mac-style. If you wish to create unix-style file on Windows, then you need to assign that connection porperty. It supports escape processing so that you can use \t, \r, \u001A, \x32, and so on. For instance, your data file is using $ as EOL, HXTT CSV can support that file.

_CSV_EOL=\n
Re:Re:TextDriver does not detect line endings of csv file automatically when delayedClose=0
Jos Brakenhoff
2017-04-24 08:02:39.0
I cannot add the _CSV_EOL property to the url, since I don't know the line ending.
The csv file is supplied by the user of our software at a later date and can have either of the line endings. We need to have the automatic detection.

In our previous version of the TextDriver this detection worked; in the latest version it does not.

Re:Re:Re:TextDriver does not detect line endings of csv file automatically when delayedClose=0
HXTT Support
2017-04-24 11:06:56.0
Fixed. Please download it.

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 1999-2017 Heng Xing Tian Tai Lab of Beijing City. | All Rights Reserved. | Privacy | Legal | Sitemap