getDataSetByQuery and getExceptionMsg

Hi,

I’m running databaseManager.getDataSetByQuery, but it can happen that the SQL and/or the Server I specify will generate a DB error.

What happens then is that you have an empty dataset, but the dataset will have an error property.

Thinking I could check for this situation using dataset.getExceptionMsg, I put this dataset.getExceptionMsg in an IF statement, but it turns out calling dataset.getExceptionMsg doesn’t retun the string of the error, but raises the error.

This looks like a bug to me, or am I missing something.

Offcourse I can work around this, by using try-catch statements, but it seems to me it should be easier.

Any thought appreciated,

Paul

PS: I also tried databaseManaget.getLastDBMessage, but that one is empty as well…

No one?

what kind of error is raised?
we really don’t do anything when you ask for a errormsg:

public String js_getExceptionMsg()
{
return errorMsg;
}

so we just return the string nothing more not special. And that string should be there when an error occurs.
Do you have an example?

Johan,

Took me some time to find my example, but here it is:

var maxReturnedRows = 1000;
var query = 'select \'<html><head></head><body>\'||decode(AO.STATUS,\'VALID\',AO.OBJECT_NAME,\'<font color="#ff0033">\'||AO.OBJECT_NAME||\'</font>\')||\'</body></html>\',AO.OBJECT_NAME from all_objects ao where ao.OWNER = \'SCRIPT\' and ao.OBJECT_TYPE = \'PROCEDURE\' AND	AO.OBJECT_NAME LIKE \'FC_WS%\''
var dataset = databaseManager.getDataSetByQuery(servername, query, null, maxReturnedRows);

if (dataset.getExceptionMsg())
{
	application.setStatusText("Error: "+dataset.getExceptionMsg());
	return;
}

Variable “servername” points to Sybase DB. Sybase doesn’t know then “all_objects” table (it’s an Oracle specific system table).

To catch the exception, I try to see if the exception message is filled:

if (dataset.getExceptionMsg())

But instead of a true/false evaluation, the following error is raised:

TypeError: com.sybase.jdbc2.jdbc.SybSQLException: ASA Error -141: Table ‘all_objects’ not found ASA Error -141: Table ‘all_objects’ not found is not a function. (refreshProcedure, line 10)

Now, which figuring out when this occurs, I noticed that on Oracle, when specifying a table in the from clause that doesn’t exist, the “dataset.getExceptionMsg()” function doesn’t raise the error.

Note that the test on Oracle was done on 2.2.4, while the test on Sybase was done on 2.2.5.

Paul

found and fix the problem
(2.2.6 or 3.x)

great!