It doesn't provide too much information other than it's having trouble 
reading your csv.
I'd start with two things:
1.) Can H2 even find the file? (You're not specifying a full path, so it's 
relative to where the H2 process is executed from)
2.) The format of the file is not as expected.  (Please post a sample of 
the .csv - say the first 3 lines)

For your other comments:
I guess CSVREAD is the only option for bulk insert.  
--> Not the only - you can write a program and do INSERTs

Can we restrict reading number of rows from csvfile ?
--> Only using TOP N or WHERE clauses.  By default it reads Start to EOF.
Can we call CSVREAD in a loop till EOF to read limited number of lines ?
--> You can use the H2 Shell Tool (Kinda like isql/osql/sqlplus) and call a 
.sql file that contains the INSERT/CSVREAD statements. You'd have to write 
your own external logic to know when to launch and what to read.

Something like: 
1.Reader keeps writting record to csv file.
2.If 1000 records present then insert into table else wait till 1000 
records.

Reading from a file open for writing
- may or may not work depending on your OS
- will provide inconsistent read results without logic remembering where 
you left off, and can detect file rotation etc... (The file is changing 
while your reading it!)
- Sounds like something Splunk should be doing instead.

I'd suggest possibly rotating the files and with logrotate or a logging 
framework and reading the archived files rather than the live file.  
Otherwise I'd suggest finding a way to send your events to the database on 
an event driven basis from the app, rather than messing with log files.

On Thursday, August 16, 2012 2:56:44 AM UTC-7, priyanka wrote:
>
> hi Thomson
>
>   just 1 month back i have started using h2 database its really great
>
> but iam facing problem with csv..As in document it has suggested the only 
> way to insert bulk database is using csv
>
> but when ever iam using csv...iam getting Io exception
> CALL CSVREAD('test.csv');
>
> IO Exception: "IOException reading test.csv"; SQL statement:
> CALL CSVREAD('test.csv') 
> [90028-168]<http://192.168.0.12:8082/query.do?jsessionid=b2bbf024f1a19510ef88a1392f646b68#>90028/90028
>  
> (Help)<http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c90028> 
>           CALL CSVREAD('test.csv');
>
> SELECT * FROM CSVREAD('test.csv');
> IO Exception: "IOException reading test.csv"; SQL statement:
> SELECT * FROM CSVREAD('test.csv') 
> [90028-168]<http://192.168.0.12:8082/query.do?jsessionid=b2bbf024f1a19510ef88a1392f646b68#>90028/90028
>  
> (Help)<http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c90028>
>
> can you please suggest me correct procedure of using csv...and is csv 
> really useful for bulk insert.
>
> Thanks in advance
>            
>
> On Tuesday, August 7, 2012 1:29:24 PM UTC-7, Thomas Mueller wrote:
>>
>> Hi,
>>
>> I guess CSVREAD is the only option for bulk insert.  
>>>
>>
>> You can use CREATE TABLE ... AS SELECT ... FROM 
>> yourOwnFunctionReturningAResultSet(...)
>>
>> Regards,
>> Thomas
>>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/GlUExG1bN2QJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to