Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

SQL Anywhere Error -1006140: I/O Error on file

3 posts in General Discussion Last posting was on 2012-06-12 19:53:32.0Z
Angel Zero Posted on 2012-06-11 20:22:26.0Z
Sender: 1ad7.4fd65250.1804289383@sybase.com
From: Angel Zero
Newsgroups: sybase.public.iq
Subject: SQL Anywhere Error -1006140: I/O Error on file
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4fd65382.1b24.1681692777@sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 11 Jun 2012 13:22:26 -0700
X-Trace: forums-1-dub 1339446146 172.20.134.41 (11 Jun 2012 13:22:26 -0700)
X-Original-Trace: 11 Jun 2012 13:22:26 -0700, 172.20.134.41
Lines: 35
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.iq:4517
Article PK: 246656

Im trying to load a file into a table calling a Stored
Procedure from a Java application, but when I try to load
the file it throws this error:

SQL Anywhere Error -1006140: I/O Error on file
C:I26-03-2012.CSV -- (hos_clientfileio.cxx 137) , sqlstate =
QBB40

My code to connect:

DriverManager.registerDriver( (Driver)
Class.forName("com.sybase.jdbc4.jdbc.SybDataSource").newInstance());

Connection con = DriverManager.getConnection(
"jdbc:sybase:Tds:111.1.1.111:1141?ServiceName=Name", "user",
"password");

Stored Procedure Load:

execute immediate WITH RESULT SET ON
'load into table #Carga(
Field1 ' || '''' || ',' || '''' || ',' ||
'Field2 ' || '''' || ',' || '''' || ',' ||
'Field3 ' || '''' || ',' || '''' || ',' ||
'Field4 ' || '''' || ',' || '''' || ',' ||
'Field5 ' || '''' || ',' || '''' || ',' ||
'Field6 ' || '''' || ',' || '''' || ',' ||
'Field7 ' || '''' || '' || 'n' || '''' || ')' || '
using client file ' || '''' || @File || '''' || '
quotes off
escapes off
with checkpoint on;

where @File is the location of the file in the user's
machine.


Manish Negandhi [TeamSybase] Posted on 2012-06-12 04:22:38.0Z
From: "Manish Negandhi [TeamSybase]" <nospam_negandhi.manish@gmail.com>
Newsgroups: sybase.public.iq
References: <4fd65382.1b24.1681692777@sybase.com>
Subject: Re: SQL Anywhere Error -1006140: I/O Error on file
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3664
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3664
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4fd6c40e@forums-1-dub>
Date: 11 Jun 2012 21:22:38 -0700
X-Trace: forums-1-dub 1339474958 10.22.241.152 (11 Jun 2012 21:22:38 -0700)
X-Original-Trace: 11 Jun 2012 21:22:38 -0700, vip152.sybase.com
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.iq:4518
Article PK: 246658


<Angel Zero> wrote in message news:4fd65382.1b24.1681692777@sybase.com...
> Im trying to load a file into a table calling a Stored
> Procedure from a Java application, but when I try to load
> the file it throws this error:
>
> SQL Anywhere Error -1006140: I/O Error on file
> C:I26-03-2012.CSV -- (hos_clientfileio.cxx 137) , sqlstate =
> QBB40
>
> My code to connect:
>
> DriverManager.registerDriver( (Driver)
> Class.forName("com.sybase.jdbc4.jdbc.SybDataSource").newInstance());
>
> Connection con = DriverManager.getConnection(
> "jdbc:sybase:Tds:111.1.1.111:1141?ServiceName=Name", "user",
> "password");
>
> Stored Procedure Load:
>
> execute immediate WITH RESULT SET ON
> 'load into table #Carga(
> Field1 ' || '''' || ',' || '''' || ',' ||
> 'Field2 ' || '''' || ',' || '''' || ',' ||
> 'Field3 ' || '''' || ',' || '''' || ',' ||
> 'Field4 ' || '''' || ',' || '''' || ',' ||
> 'Field5 ' || '''' || ',' || '''' || ',' ||
> 'Field6 ' || '''' || ',' || '''' || ',' ||
> 'Field7 ' || '''' || '' || 'n' || '''' || ')' || '
> using client file ' || '''' || @File || '''' || '
> quotes off
> escapes off
> with checkpoint on;
>
> where @File is the location of the file in the user's
> machine.

Can you try executing this proc using dbisql ? , you might want to check
value for db option ALLOW_READ_CLIENT_FILE

-HTH
Manish Negandhi
[TeamSybase]


Angel Zero Posted on 2012-06-12 19:53:32.0Z
Sender: 4d60.4fd764ac.1804289383@sybase.com
From: Angel Zero
Newsgroups: sybase.public.iq
Subject: Re: SQL Anywhere Error -1006140: I/O Error on file
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4fd79e3c.5760.1681692777@sybase.com>
References: <4fd6c40e@forums-1-dub>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 12 Jun 2012 12:53:32 -0700
X-Trace: forums-1-dub 1339530812 172.20.134.41 (12 Jun 2012 12:53:32 -0700)
X-Original-Trace: 12 Jun 2012 12:53:32 -0700, 172.20.134.41
Lines: 58
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.iq:4519
Article PK: 246659


> <Angel Zero> wrote in message
> > news:4fd65382.1b24.1681692777@sybase.com... Im trying to
> > load a file into a table calling a Stored Procedure from
> > a Java application, but when I try to load the file it
> throws this error: >
> > SQL Anywhere Error -1006140: I/O Error on file
> > C:I26-03-2012.CSV -- (hos_clientfileio.cxx 137) ,
> > sqlstate = QBB40
> >
> > My code to connect:
> >
> > DriverManager.registerDriver( (Driver)
> >
> Class.forName("com.sybase.jdbc4.jdbc.SybDataSource").newIn
> stance()); >
> > Connection con = DriverManager.getConnection(
> > "jdbc:sybase:Tds:111.1.1.111:1141?ServiceName=Name",
> > "user", "password");
> >
> > Stored Procedure Load:
> >
> > execute immediate WITH RESULT SET ON
> > 'load into table #Carga(
> > Field1 ' || '''' || ',' || '''' || ',' ||
> > 'Field2 ' || '''' || ',' || '''' || ',' ||
> > 'Field3 ' || '''' || ',' || '''' || ',' ||
> > 'Field4 ' || '''' || ',' || '''' || ',' ||
> > 'Field5 ' || '''' || ',' || '''' || ',' ||
> > 'Field6 ' || '''' || ',' || '''' || ',' ||
> > 'Field7 ' || '''' || '' || 'n' || '''' || ')' || '
> > using client file ' || '''' || @File || '''' || '
> > quotes off
> > escapes off
> > with checkpoint on;
> >
> > where @File is the location of the file in the user's
> > machine.
>
> Can you try executing this proc using dbisql ? , you
> might want to check value for db option
> ALLOW_READ_CLIENT_FILE
>
> -HTH
> Manish Negandhi
> [TeamSybase]
>
>

I've executed this procedure on Interactive SQL for Java and
it works fine, the problem is when you call the procces from
the Java aplication.

And for the options, I set them before the load part:

set temporary option string_rtruncation = 'off';
set temporary option notify_modulus = 10000;
set option allow_read_client_file = 'on';
grant READCLIENTFILE to "user";