Hi Andrej,
exportTable also will not dump the table header. Functionally it is
same as exportQuery, just different interfaces to the users.
It is puzzling me also how you are able to export using exportQuery
successfully but not through the exportTable, by quick look at the
code I could not find how that could happen. Underneath exportTable
just forms a select query based on the table names and the schema name.
Are you passing the same connection object to both the exportTable and
the exportQuery ? By any chance the connection you are passing to
these functions has different default schema name than what the XYZ
table was created with ?
From looking at your code snippet looks like you are calling internal
export functions directly, I think they are not supposed to be called
by an application directly. This functionality is available to the
users through System procedures SYSCS_UTIL.SYSCS_EXPORT_TABLE and
SYSCS_UTIL.SYSCS_EXPORT_QUERY.
more info in the docs at:
http://db.apache.org/derby/docs/10.1/tools/rtoolsimport92876.html
Thanks
-suresh
Andrej Tibaut wrote:
Hi all!
Could please someone help me with the following problem. In database I have
a table that I need
to export into CSV format.
If I use these lines
try {
Export.exportQuery(conn,"SELECT * FROM XYZ", "c:/export.txt", ",", "\"",
"iso-8859-2");
} catch (Exception e) {}
I get the data in table in CSV format. However, this is only data in table
without table header (of
course, based on SQL statement).
So, if I use these lines (I guess that exportTable returns also the table
header)
try {
Export.exportTable(conn, null, "XYZ", "c:/export.txt", ",", "\"",
"iso-8859-2");
} catch (Exception e) {}
I get the following exception:
SQL Exception: Table 'XYZ' does not exist.
With lines
try {
Export.exportTable(conn, null, "abc.XYZ", "c:/export.txt", ",", "\"",
"iso-8859-2");
} catch (Exception e) {}
I get the following exception:
SQL Exception: Table 'abc.XYZ' does not exist.
And, with lines
try {
Export.exportTable(conn, "abc", "XYZ", "c:/export.txt", ",", "\"",
"iso-8859-2");
} catch (Exception e) {}
I get the following exception:
SQL Exception: Schema 'abc' does not exist.
What should I use? And, additional question: does exportTable returns also
table
header?
Thanks in advance!
Andrej