Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
catch SQL error
ShlomiW
<p>Hi all,</p><p> </p><p>I would like to know if there is any way to apply an error catch mechanism for SQL when working with postgresql.</p><p> </p><p>For now when I get an error message I see this section in the bottom of my report:</p><pre class="_prettyXprint _lang-">The following items have errors:Table (id = 7482):+ Cannot get the result set metadata. org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object.SQL error #1:ERROR: syntax error at or near "SEsLECT" Position: 2 ; org.postgresql.util.PSQLException: ERROR: syntax error at or near "SEsLECT" Position: 2</pre><p>where table ( ID = 7482 ), is the table that uses the Data-set with the SQL error</p><p> </p><p><strong>Note: I know what is my SQL error in this case, I created it so I will have an example</strong></p><p> </p><p>what I would like to achieve is replace this message with my own, something like:</p><p>"There was an error please contact our support team, Have a great day"</p><p> </p><p>in other part of the report I used the following logic:</p><pre class="_prettyXprint _lang-">try{ CODE}catch (e){ displayErrorServerSide(e);} </pre><p>this uses the JavaScript TRY and CATCH mechanism in order to print all my errors to a log file, but I can't use it in this case because I'm not running the Data-set (Birt does)</p><p> </p><p>Hope that my problem is clear</p><p>Waiting for a reply</p><p>Have a great day</p><p>Shlomi</p><p> </p>
Find more posts tagged with
Comments
ShlomiW
<p>anyone has any idea???</p><p> </p><p>really need your help, I didn't see an documentation on this issue</p>
ShlomiW
<p>any ideas anyone?</p>
kclark
<p>How are you deploying your reports? If you're using the REAPI's then it should be easy enough to do with some Java code.</p>
ShlomiW
<p>Hi kclark,</p><p> </p><p>I'm using Eclipse and the BIRT designer in order to create my reports so I don't think that I can use a Java code in order to accomplish that.</p><p> </p><p>Do you have any other ideas?</p>
kclark
<p>I haven't got an example working in the designer yet, but one thing you could try to do is create a class to connect to your db and test the query and return a Boolean. Then you could call that class from the fetch() of your data set and if it returns false change your query or perform some other logic.</p>
ShlomiW
<p>Hi ,</p><p> </p><p>As I said here: <a data-ipb='nomediaparse' href='
http://www.eclipse.org/forums/index.php/t/673729/'>http://www.eclipse.org/forums/index.php/t/673729/</a></p><p>The
onF<span style="font-size:14px;">etch() event </span><span>handler</span><span style="font-size:14px;"> is never called so I can't apply any logic there.</span></p><p> </p><p><span style="font-size:14px;">do you any other </span><span>ideas</span><span style="font-size:14px;">?</span></p>
kclark
<p>You could also created a scripted data set and catch the errors in there. I'll try and build you and example.</p>
ShlomiW
<p>an example will be great.</p><p> </p><p>waiting to hear from you again</p><p>Shlomi</p>