wbExport - capture error

10 views
Skip to first unread message

Darshak

unread,
Jan 31, 2023, 12:19:06 AM1/31/23
to SQL Workbench/J - DBMS independent SQL tool
Hi,

SQL failure during wbExport is not being captured in generated files. 
And it may not be noticed while running multiple SQLs from cmdline 
e.g. in Oracle , wbExport query failed due to missing privileges to access DBA_ views

Error is captured in log file.

Is there way to capture error in generated file also while running using wbExport ?

Regards,
 Darshak



Thomas Kellerer

unread,
Feb 1, 2023, 2:54:43 AM2/1/23
to sql-wo...@googlegroups.com
Hmm, SQL Workbench doesn't really use DBA_ views in Oracle. It either uses the ALL_ or USER_ variant.
And I wouldn't expect a failure to use those, to abort the export.

Can you send me the original export query and the log file with the errors?


Regards
Thomas

Darshak

unread,
Feb 6, 2023, 3:24:48 AM2/6/23
to SQL Workbench/J - DBMS independent SQL tool
Hi,

e.g. 
User does not have privilege to query catalog tables/ views in Oracle.
WbExport -type=xlsx
         -file=$[fileName]
         -append=true
         -trimCharData=true
         -SheetName="ORA_TSP_$[DATE]"
         -header=true
         -autoColWidth=true;
SELECT *
FROM DBA_tablespaces
ORDER BY TABLESPACE_NAME;

unfortunately, I can not attach log file .

my point is when user does not have privilege then error should also be captured in generated file otherwise while running lots of queries from cmdline (batch file) may not notice error at all unless check logfile.

Regards,
 Darshak

Thomas Kellerer

unread,
Feb 6, 2023, 5:20:49 AM2/6/23
to sql-wo...@googlegroups.com
This isn't really related to privileges. If the source query of an export doesn't work, the export is aborted and the error message is displayed.

Do do you suggest to write the error message into the export file rather than not creating the export file?
I have never seen a tool do that.

If you run a batch of statements, you should investigate the logfile afterwards.

You might want to run SQL Workbench using -abortOnError=true so that the whole script terminates, if an error occurs instead of continuing with the next statement.
You can then check the exit code of SQL Workbench and take appropriate action in case of an error (e.g. send an email).


Regards
Thomas


Darshak schrieb am 06.02.2023 um 09:24:
> Hi,
>
> *e.g. *
> *User does not have privilege to query catalog tables/ views in Oracle.*
> WbExport -type=xlsx
>          -file=$[fileName]
>          -append=true
>          -trimCharData=true
>          -SheetName="ORA_TSP_$[DATE]"
>          -header=true
>          -autoColWidth=true;
> SELECT *
> *FROM DBA_tablespaces*
> ORDER BY TABLESPACE_NAME;
>
> unfortunately, I can not attach log file .
>
> my point is when user does not have *privilege *then error should also be captured in generated file otherwise while running lots of queries from cmdline (batch file) may not notice error at all unless check logfile.
>
> Regards,
>  Darshak
>
>
>
> On Wednesday, 1 February, 2023 at 1:24:43 pm UTC+5:30 Thomas Kellerer wrote:
>
> Hmm, SQL Workbench doesn't really use DBA_ views in Oracle. It either uses the ALL_ or USER_ variant.
> And I wouldn't expect a failure to use those, to abort the export.
>
> Can you send me the original export query and the log file with the errors?
>
>
> Regards
> Thomas
>
>
> Darshak schrieb am 31.01.2023 um 06:19:
> > Hi,
> >
> > SQL failure during wbExport is not being captured in generated files. 
> > And it may not be noticed while running multiple SQLs from cmdline 
> > e.g. in Oracle , wbExport query failed due to missing privileges to access DBA_ views
> >
> > Error is captured in log file.
> >
> > Is there way to capture error in generated file also while running using wbExport ?
> >
> > Regards,
> >  Darshak
>
> --
> You received this message because you are subscribed to the Google Groups "SQL Workbench/J - DBMS independent SQL tool" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sql-workbenc...@googlegroups.com <mailto:sql-workbenc...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sql-workbench/dc1e038a-21cc-4297-b6a3-65916a6b02f5n%40googlegroups.com <https://groups.google.com/d/msgid/sql-workbench/dc1e038a-21cc-4297-b6a3-65916a6b02f5n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Darshak

unread,
Feb 6, 2023, 6:58:48 AM2/6/23
to SQL Workbench/J - DBMS independent SQL tool
Hi,

Scenario :
10 wbExport (XLS) with queries in a SQL file which is being called from cmd line (as batch file)
it should generate 10 sheets in a Excel file.

>> If you run a batch of statements, you should investigate the logfile afterwards.
e.g.
 its runs perfectly in one env. (e.g. dev) generates 10 sheets in a excel file but in other env. (e.g. UAT) due to missing privilege, 1 wbExport/query it failed.
1 query failed due to role / required privilege is not granted to user.
but did not error notice on cmd line as other person did not check logfile for UAT execution.

>> Do do you suggest to write the error message into the export file rather than not creating the export file?
YES, if possible

Regards,
Darshak
Reply all
Reply to author
Forward
0 new messages