HXTT Text(CSV)
Problem with line feed: Reading text file on Linux
James Frankman
2006-12-19 07:01:31.0
I am writing an applicaiton that uses Hibernate and the HXTT text driver to read a text file. The applicaiton works on windows, but when I run in on linux, it reads the first line ok, but when it reads the second line it is off by one character. I think it something to do with windows using "\r\n" to mark the end of the line, and linux only uses "\n". Is there a system property I should set so that the HXTT driver properly reads text files on Linux?
Re:Problem with line feed: Reading text file on Linux
HXTT Support
2006-12-19 07:18:39.0
What's your table defination sql for create table?
Re:Re:Problem with line feed: Reading text file on Linux
james frankman
2006-12-19 07:29:36.0
create table if not exists indexDetail (
ACCOUNTNO varchar(15),
BLANK1 varchar(1),
CAPTUREDATE varchar(6),
BLANK2 varchar(1),
SEQUENCENO varchar(12),
BLANK3 varchar(1),
INTERNALUSE1 varchar(98),
BLANK4 varchar(1),
AVAILABILITYCODE varchar(1),
BLANK5 varchar(1),
IMAGESTARTINGLOCATION varchar(18),
BLANK6 varchar(1),
IMAGELENGTH varchar(9),
BLANK7 varchar(1),
FRONTBACKINDICATOR varchar(1),
AMOUNT varchar(10),
SERIAL varchar(10),
INTERNALUSE2 varchar(17),
ROUTINGTRANSIT varchar(9),
AMOUNT2 varchar(10),
CHECKNUMBER varchar(15),
POSTEDDATE varchar(8),
INTERNALUSE3 varchar(15),
CORRECTIONINDICATOR varchar(1),
Blanks varchar(338),
_StuffedColumn char(2) default '\r\n'
);
Re:Re:Re:Problem with line feed: Reading text file on Linux
2006-12-19 07:31:48.0
>_StuffedColumn char(2) default '\r\n'
Changed it to _StuffedColumn char(1) default '\n'

Re:Re:Re:Re:Problem with line feed: Reading text file on Linux
james frankman
2006-12-19 07:37:04.0
The problem with that is that my code will no longer be portable. I will need to change the schema if I move to another platform. Instead, could I set the System property:

System.setProperty("line.separator", "\r\n");

This way I could move the code from platform to platform. Will this cause any problems since Linux only uses "\n" instead of "\r\n"?
Re:Re:Problem with line feed: Reading text file on Linux
james frankman
2006-12-19 10:03:59.0
create table if not exists indexDetail (
ACCOUNTNO varchar(15),
BLANK1 varchar(1),
CAPTUREDATE varchar(6),
BLANK2 varchar(1),
SEQUENCENO varchar(12),
BLANK3 varchar(1),
INTERNALUSE1 varchar(98),
BLANK4 varchar(1),
AVAILABILITYCODE varchar(1),
BLANK5 varchar(1),
IMAGESTARTINGLOCATION varchar(18),
BLANK6 varchar(1),
IMAGELENGTH varchar(9),
BLANK7 varchar(1),
FRONTBACKINDICATOR varchar(1),
AMOUNT varchar(10),
SERIAL varchar(10),
INTERNALUSE2 varchar(17),
ROUTINGTRANSIT varchar(9),
AMOUNT2 varchar(10),
CHECKNUMBER varchar(15),
POSTEDDATE varchar(8),
INTERNALUSE3 varchar(15),
CORRECTIONINDICATOR varchar(1),
Blanks varchar(338),
_StuffedColumn char(2) default '\r\n'
);
Re:Re:Re:Re:Re:Re:Problem with line feed: Reading text file on Linux
HXTT Support
2006-12-19 17:04:47.0
You can try:
_StuffedColumn longvarchar default '\n'
Then it can be platform independence.


Google