Re: SQL-Statement UNLOAD TO and jdbc!!
Posted in 2000
Sorry my mistake. The tool is called jSelect.
Sujit
---------------------- Forwarded by Sujit Pal on 03/15/2000 11:58 AM
---------------------------
From: Sujit Pal on 03/15/2000 11:00 AM
To: Jacob Salomon <jakesalomon@my-deja.com>
cc: informix-list@iiug.org
Subject: Re: SQL-Statement UNLOAD TO and jdbc!! (Document link: Database
'Sujit Pal', View '($Sent)')
Jacob/Caroline
Or you could use my jSQL tool available in the IIUG archives (shameless
plug<g>). It currently supports columnar and tabular formats, but the code
addition to produce pipe-delimited data is fairly trivial.
HTH
Sujit
Jacob Salomon <jakesalomon@my-deja.com> on 03/15/2000 08:40:38 AM
Please respond to Jacob Salomon <jakesalomon@my-deja.com>
To: informix-list@iiug.org
cc:
Subject: Re: SQL-Statement UNLOAD TO and jdbc!!
In article <38CFABB3.76D52195@siemens.ch>,
"C. Fuchs Bausch" <caroline.fuchs-bausch@siemens.ch> wrote:
> Hi,
>
> I'm working with the informix jdbc driver 2.0. My task is to save
> tables to ASCII files.
>
> I found the SQL-Statement:
> UNLOAD TO 'filename' SELECT * FROM tablename;>
> In my code I try to execute this statement in this way:
>
> stm.execute("UNLOAD TO \\'C:\\\\TMP\\\\table.tmp\\' SELECT * FROM table;");
>
> and as:
>
> stm.execute("UNLOAD TO 'C:\\\\TMP\\\\table.tmp' SELECT * FROM table;");
>
> and in a few more variations. The result is always that I receive a
> SQL-Exception:
>
> A syntax error has occured
>
> Does anybody has an idea what's the reason for this exception?? Simple
> Select statements are working.
>
> Thanx
> caroline
Caroline,
Simple problem: The LOAD and UNLOAD statements are not true SQL
statements. They are utility commands in dbaccess (and isql) as a
convenience but dbaccess does not send these commands to the engine. In
the case of an unload statement, dbaccess sends the SQL part to the
engine and creates the list (with [pipe ]delimiters) itself.
4GL also accepts LOAD and UNLOAD commands and handles them in pretty
much the same way. But you cannot PREPARE an UNLOAD statement, nor can
you use it in a stored procedure.
Solution: Not as easy as explaining the problem.
Obviously, jdbc is not the tool for this function. You could try
running this command in dbaccess or 4GL. Or you could write super-
general formatting code to mimic what dbaccess does. But why reinvent
the wheel?
--
+----- Jacob Salomon - DBA JSalomon@bn.com - --------------------------+
|------------------- Bulletin Board Announcement ----------------------|
| Congregants will please note that the bowl at the back of the church |
| bearing the sign "For the Sick" is for monetary contributions only. |
+----------------------------------------------------------------------+
Sent via Deja.com http://www.deja.com/
Before you buy.