Home
Analytics
Sybase syntax
VSafonov
I have a simple query<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>select distinct au.userid,
au.officecde,
ao.regioncde,
isnull(ao.terrcde,"Admin") as terrcde
from ACT_USER au ,ACT_OFFICE ao
where au.officecde *= ao.officecde
</pre>
<br />
Gets me a very strange result. This runs normally in straight java. Using a sybase jconn3.jar com.sybase.jdbc3.jdbc.SybDriver (v6.0)<br />
<br />
as soon as I remove isnull - everything runs fine. Both in eclipse and actuate designer.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.doRun(DatasetPreviewTask.java:135)
at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.runDataset(DatasetPreviewTask.java:97)
at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.execute(DatasetPreviewTask.java:49)
at org.eclipse.birt.report.designer.data.ui.dataset.DataSetPreviewer.preview(DataSetPreviewer.java:69)
at org.eclipse.birt.report.designer.data.ui.dataset.ResultSetPreviewPage$5.run(ResultSetPreviewPage.java:336)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Caused by: org.eclipse.birt.report.data.adapter.api.AdapterException: An exception occurred during processing. Please see the following message for details:
Failed to prepare the query execution for the data set: UsersDS
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:Invalid column name 'Admin'.
;
com.sybase.jdbc3.jdbc.SybSQLException: Invalid column name 'Admin'.
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:644)
at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.extractQuery(DatasetPreviewTask.java:166)
at org.eclipse.birt.report.engine.api.impl.DatasetPreviewTask.doRun(DatasetPreviewTask.java:126)
... 5 more
Caused by: org.eclipse.birt.data.engine.core.DataException: Failed to prepare the query execution for the data set: UsersDS
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:Invalid column name 'Admin'.
;
com.sybase.jdbc3.jdbc.SybSQLException: Invalid column name 'Admin'.
at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:345)
at org.eclipse.birt.data.engine.impl.PreparedQuery.doPrepare(PreparedQuery.java:455)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.produceQueryResults(PreparedDataSourceQuery.java:190)
at org.eclipse.birt.data.engine.impl.PreparedDataSourceQuery.execute(PreparedDataSourceQuery.java:178)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery.execute(PreparedOdaDSQuery.java:145)
at org.eclipse.birt.report.data.adapter.impl.DataRequestSessionImpl.execute(DataRequestSessionImpl.java:624)
... 7 more
Caused by: org.eclipse.birt.data.engine.odaconsumer.OdaDataException: 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:Invalid column name 'Admin'.
;
com.sybase.jdbc3.jdbc.SybSQLException: Invalid column name 'Admin'.
at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.newException(ExceptionHandler.java:52)
at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.throwException(ExceptionHandler.java:108)
at org.eclipse.birt.data.engine.odaconsumer.ExceptionHandler.throwException(ExceptionHandler.java:84)
at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.getRuntimeMetaData(PreparedStatement.java:414)
at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.getProjectedColumns(PreparedStatement.java:377)
at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.declareCustomColumn(PreparedStatement.java:1223)
at org.eclipse.birt.data.engine.executor.DataSourceQuery.addCustomFields(DataSourceQuery.java:673)
at org.eclipse.birt.data.engine.executor.DataSourceQuery.prepareColumns(DataSourceQuery.java:397)
at org.eclipse.birt.data.engine.executor.DataSourceQuery.prepare(DataSourceQuery.java:340)
at org.eclipse.birt.data.engine.impl.PreparedOdaDSQuery$OdaDSQueryExecutor.prepareOdiQuery(PreparedOdaDSQuery.java:442)
at org.eclipse.birt.data.engine.impl.QueryExecutor.prepareExecution(QueryExecutor.java:341)
... 12 more
Caused by: org.eclipse.birt.report.data.oda.jdbc.JDBCException: SQL statement does not return a ResultSet object.
SQL error #1:Invalid column name 'Admin'.
;
com.sybase.jdbc3.jdbc.SybSQLException: Invalid column name 'Admin'.
at org.eclipse.birt.report.data.oda.jdbc.Statement.executeQuery(Statement.java:464)
at org.eclipse.birt.report.data.oda.jdbc.Statement.getMetaUsingPolicy1(Statement.java:403)
at org.eclipse.birt.report.data.oda.jdbc.Statement.getMetaData(Statement.java:303)
at org.eclipse.birt.report.data.oda.jdbc.bidi.BidiStatement.getMetaData(BidiStatement.java:56)
at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQuery.doGetMetaData(OdaQuery.java:412)
at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaQuery.getMetaData(OdaQuery.java:379)
at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.getRuntimeMetaData(PreparedStatement.java:407)
... 19 more
Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Invalid column name 'Admin'.
at com.sybase.jdbc3.tds.Tds.processEed(Tds.java:2942)
at com.sybase.jdbc3.tds.Tds.nextResult(Tds.java:2246)
at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(SybStatement.java:220)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(SybStatement.java:203)
at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(SybStatement.java:1698)
at com.sybase.jdbc3.jdbc.SybStatement.executeQuery(SybStatement.java:1683)
at com.sybase.jdbc3.jdbc.SybPreparedStatement.executeQuery(SybPreparedStatement.java:97)
at org.eclipse.birt.report.data.oda.jdbc.Statement.executeQuery(Statement.java:460)
... 25 more
</pre>
Find more posts tagged with
Comments
kclark
I haven't tried it yet but you could try replacing<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
isnull(ao.terrcde,"Admin") as terrcde
</pre>
<br />
with<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
isnull(ao.terrcde,0) as terrcde
</pre>
<br />
To make sure the query isn't having a problem with replacing null with a String because it looks like the query is looking for Admin as a column.
VSafonov
since the output is char - i had success with changing it to <pre class='_prettyXprint _lang-auto _linenums:0'>isnull(ao.terrcde,convert(varchar(20),0)) as terrcde</pre> to avoid conversion issues. But it would be nicer if my original value would be allowed.
kclark
You could also try this<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
isnull(ao.terrcde,string("Admin")) as terrcde
</pre>
VSafonov
nope... birt again complains of column named admin and sybase doesn't want to run it at all - string is not a valid SQL word.
Clement Wong
Have you tried using a single quote instead of a double quote for the <strong class='bbc'>'admin'</strong>?<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>select distinct au.userid,
au.officecde,
ao.regioncde,
isnull(ao.terrcde,'Admin') as terrcde
from ACT_USER au ,ACT_OFFICE ao
where au.officecde *= ao.officecde</pre>
Since you mentioned you tried with "actuate designer", are you're referring to BIRT Designer Professional? Have you tried using the Sybase driver we include (com.actuate.jdbc.sybase.SybaseDriver (Actuate Sybase Driver))? What version of Sybase are you running?<br />
<br />
I have Sybase 12.5.3 Server, and am using Actuate BIRT Designer Professional 11 SP4 Fix1 and our included Sybase JDBC driver. In my sample query, I used single quote and it doesn't error out.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>select dbo.customers.custID, isnull(dbo.customers.contact_last,'admin') as terrcde
from dbo.customers
</pre>
And in another similar to your original query:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>select distinct au.custID,
au.postalcode,
ao.officeID,
isnull(ao.state,'Admin') as terrcde
from dbo.customers au, dbo.offices ao
where au.postalcode *= ao.postalcode</pre>
VSafonov
single quotes worked