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.

xp_write_file to client directory

5 posts in General Discussion Last posting was on 2004-09-07 15:44:25.0Z
Brett Posted on 2004-09-03 14:41:04.0Z
Sender: 1b24.41349d3b.1804289383@sybase.com
From: Brett
Newsgroups: ianywhere.public.general
Subject: xp_write_file to client directory
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4138827f.529c.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 3 Sep 2004 07:41:04 -0700
X-Trace: forums-1-dub 1094222464 10.22.241.41 (3 Sep 2004 07:41:04 -0700)
X-Original-Trace: 3 Sep 2004 07:41:04 -0700, 10.22.241.41
Lines: 8
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:3488
Article PK: 7391

I'm running ASA 9.0.1 on Linux with a database table that
stores binary data. Right now whenever I call xp_write_file
to extract the binary data to a file, the file gets written
to whichever directory I specify on the server. Is there a
way I can get the binary data out of the database and prompt
the client where they would like to store the file on their
computer without actually extracting the file to the server?
Thanks.


Greg Fenton Posted on 2004-09-03 15:10:32.0Z
From: Greg Fenton <greg.fenton_NOSPAM_@ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla Thunderbird 1.6.3.2f (Windows/20040803)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: xp_write_file to client directory
References: <4138827f.529c.1681692777@sybase.com>
In-Reply-To: <4138827f.529c.1681692777@sybase.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: gfenton-xp.sybase.com
Message-ID: <41388af5$1@forums-2-dub>
X-Original-Trace: 3 Sep 2004 08:17:09 -0700, gfenton-xp.sybase.com
Lines: 34
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 3 Sep 2004 07:59:34 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 3 Sep 2004 08:10:32 -0700
X-Trace: forums-1-dub 1094224232 10.22.108.75 (3 Sep 2004 08:10:32 -0700)
X-Original-Trace: 3 Sep 2004 08:10:32 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:3489
Article PK: 7390


Brett wrote:
> Is there a
> way I can get the binary data out of the database and prompt
> the client where they would like to store the file on their
> computer without actually extracting the file to the server?

Not with xp_write_file(). It is a server-side command. From the ASA
9.x online docs:

"The filename is relative to the current working directory of the
database server. If the file already exists, its contents are
overwritten."

See:

http://tinyurl.com/5r5o7 (shortcut to docs on ianywhere.com)

If you are using DBISQL as the client application, you could look to
using the OUTPUT statement.

If you are writing your own application, then the app will have to
extract the binary data from the result set of a query and save that
data to a file yourself. If you describe the programming environment
(language, ASA API, etc...), someone might provide some sample code for you.

Hope this helps,
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/


Brett Posted on 2004-09-07 13:32:10.0Z
Sender: 6323.413db98a.1804289383@sybase.com
From: Brett
Newsgroups: ianywhere.public.general
Subject: Re: xp_write_file to client directory
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <413db9f7.6326.1681692777@sybase.com>
References: <41388af5$1@forums-2-dub>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 7 Sep 2004 06:39:03 -0700, 10.22.241.42
Lines: 43
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 7 Sep 2004 06:20:50 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 7 Sep 2004 06:32:10 -0700
X-Trace: forums-1-dub 1094563930 10.22.108.75 (7 Sep 2004 06:32:10 -0700)
X-Original-Trace: 7 Sep 2004 06:32:10 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:3494
Article PK: 7395

I'm using PHP and PEAR::DB to connect to the database. If
anyone can offer some advice I'd appreciate it. Thanks.

> Brett wrote:
> > Is there a
> > way I can get the binary data out of the database and
> > prompt the client where they would like to store the
> > file on their computer without actually extracting the
> file to the server?
>
> Not with xp_write_file(). It is a server-side command.
> From the ASA 9.x online docs:
>
> "The filename is relative to the current working
> directory of the
> database server. If the file already exists, its
> contents are
> overwritten."
>
> See:
>
> http://tinyurl.com/5r5o7 (shortcut to docs on
> ianywhere.com)
>
> If you are using DBISQL as the client application, you
> could look to using the OUTPUT statement.
>
> If you are writing your own application, then the app will
> have to extract the binary data from the result set of a
> query and save that data to a file yourself. If you
> describe the programming environment (language, ASA API,
> etc...), someone might provide some sample code for you.
>
> Hope this helps,
> greg.fenton
> --
> Greg Fenton
> Consultant, Solution Services, iAnywhere Solutions
> --------
> Visit the iAnywhere Solutions Developer Community
> Whitepapers, TechDocs, Downloads
> http://www.ianywhere.com/developer/


Greg Fenton Posted on 2004-09-07 14:33:34.0Z
From: Greg Fenton <greg.fenton_NOSPAM_@ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla Thunderbird 1.6.3.2f (Windows/20040803)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: xp_write_file to client directory
References: <41388af5$1@forums-2-dub> <413db9f7.6326.1681692777@sybase.com>
In-Reply-To: <413db9f7.6326.1681692777@sybase.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: gfenton-xp.sybase.com
Message-ID: <413dc85d@forums-2-dub>
X-Original-Trace: 7 Sep 2004 07:40:29 -0700, gfenton-xp.sybase.com
Lines: 28
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 7 Sep 2004 07:22:15 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 7 Sep 2004 07:33:34 -0700
X-Trace: forums-1-dub 1094567614 10.22.108.75 (7 Sep 2004 07:33:34 -0700)
X-Original-Trace: 7 Sep 2004 07:33:34 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:3495
Article PK: 7397


Brett wrote:
> I'm using PHP and PEAR::DB to connect to the database. If
> anyone can offer some advice I'd appreciate it. Thanks.

Out of curiosity, how are you using PEAR::DB with ASA?

If you are using the ASA PHP module, it ships with an example called
"blob.php" which shows how to extract data from a "blob" (LONG VARCHAR
or LONG BINARY). In your PHP, you'd load the data into an array and
then write that out to a file created by your PHP code.

Does this help?

BTW: some of the other PHP/ASA folks hang out in the ASA newsgroup for
Linux/Unix, if you are interested in reading what others have asked
about PHP:

sybase.public.sqlanywhere.linux

Hope this helps,
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/


Brett Posted on 2004-09-07 15:44:25.0Z
Sender: 6578.413dd895.1804289383@sybase.com
From: Brett
Newsgroups: ianywhere.public.general
Subject: Re: xp_write_file to client directory
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <413dd8f6.6588.1681692777@sybase.com>
References: <413dc85d@forums-2-dub>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 7 Sep 2004 08:51:18 -0700, 10.22.241.42
Lines: 33
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 7 Sep 2004 08:33:03 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 7 Sep 2004 08:44:25 -0700
X-Trace: forums-1-dub 1094571865 10.22.108.75 (7 Sep 2004 08:44:25 -0700)
X-Original-Trace: 7 Sep 2004 08:44:25 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:3496
Article PK: 7399

I'm using freetds. I'll take a look in the Linux newsgroup,
thanks for the help.

> Brett wrote:
> > I'm using PHP and PEAR::DB to connect to the database.
> > If anyone can offer some advice I'd appreciate it.
> Thanks.
>
> Out of curiosity, how are you using PEAR::DB with ASA?
>
> If you are using the ASA PHP module, it ships with an
> example called "blob.php" which shows how to extract data
> from a "blob" (LONG VARCHAR or LONG BINARY). In your PHP
> , you'd load the data into an array and then write that
> out to a file created by your PHP code.
>
> Does this help?
>
> BTW: some of the other PHP/ASA folks hang out in the ASA
> newsgroup for Linux/Unix, if you are interested in
> reading what others have asked about PHP:
>
> sybase.public.sqlanywhere.linux
>
> Hope this helps,
> greg.fenton
> --
> Greg Fenton
> Consultant, Solution Services, iAnywhere Solutions
> --------
> Visit the iAnywhere Solutions Developer Community
> Whitepapers, TechDocs, Downloads
> http://www.ianywhere.com/developer/