Bug 1272842

Summary: Sybase 15.7: "DataSetLookupException: Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed"
Product: [Retired] JBoss BPMS Platform 6 Reporter: Jan Hrcek <jhrcek>
Component: Business CentralAssignee: Neus Miras <nmirasch>
Status: CLOSED EOL QA Contact: Lukáš Petrovický <lpetrovi>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.2.0CC: kverlaen, rrajasek
Target Milestone: CR2Keywords: TestBlocker
Target Release: 6.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 20:08:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
server.log with exceptions none

Description Jan Hrcek 2015-10-19 04:58:09 UTC
Created attachment 1084259 [details]
server.log with exceptions

Description of problem:
The data set used in jbpm-console-ng - Process Instances is not working with Sybase 15.7. After entering the perspective, I'm getting modal dialog with exception:

org.dashbuilder.dataset.exception.DataSetLookupException: Can't lookup on specified data set: jbpmProcessInstances
...
Caused by: java.sql.SQLException: Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed.  Use the CONVERT function to run this query


Version-Release number of selected component (if applicable):
BPM Suite 6.2.0 ER4

How reproducible:
Always

Steps to Reproduce:
1. Deploy business-central with Sybase 15.7 as datasource
2. Navigate to Process instances perspective


Actual results:
Modal with error displayed

Expected results:
No error, data set is working

Additional info:

Comment 1 Jan Hrcek 2015-10-20 13:56:29 UTC
Sorry, missed a step to reproduce:
3. In Process instances create new Filter tab with: column Priority >= 3.

Comment 2 David Gutierrez 2015-10-20 15:16:00 UTC
This is also happening in other DBs lie for instance H2. Every time a filter on a numeric values is added to a data lookup calls the SQL query executed by the SQL provider fails because some DBs can't perform automatic conversions from string to numeric.

The solution is to make sure any SQL criteria on top of a numeric value is processed correctly, which means formatting the parameters according to the target column type. 

The error has been reported on Dashbuilder's community JIRA:

https://issues.jboss.org/browse/DASHBUILDE-58

Comment 3 David Gutierrez 2015-10-23 10:16:07 UTC
A fix has been submitted for approval.

(master)
https://github.com/dashbuilder/dashbuilder/pull/55

(0.3.x)
https://github.com/dashbuilder/dashbuilder/pull/56


They will be merge today by EOD.

Comment 5 Jan Hrcek 2015-11-09 07:13:00 UTC
Verification blocked by bug # 1277466 
Will be verified with the next build after that bug is fixed.

Comment 6 Jan Hrcek 2015-11-19 08:10:50 UTC
The issue still persists and it is specific to sybase 15.7 (on other databases it's working). The error is the same as in original attachment (pasting it here for reference):
---------
13:49:34,636 ERROR [org.dashbuilder.dataprovider.backend.sql.JDBCUtils] (http-localhost/127.0.0.1:8080-8) SELECT COUNT(*) FROM (SELECT processInstanceId, processId, start_date, end_date, status, parentProcessInstanceId, outcome, duration, user_identity, processVersion, processName, correlationKey, externalId, processInstanceDescription FROM ProcessInstanceLog WHERE status = '1') "dbSQL"
13:49:34,637 ERROR [org.dashbuilder.dataset.backend.exception.ExceptionManager] (http-localhost/127.0.0.1:8080-8) Can't lookup on specified data set: jbpmProcessInstances: org.dashbuilder.dataset.exception.DataSetLookupException: Can't lookup on specified data set: jbpmProcessInstances
...
Caused by: java.sql.SQLException: Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed.  Use the CONVERT function to run this query.
------
Since David already fixed something in Dashbuilder, I'm assigning it to Neus to review the problematic query executed for console (notice the: WHERE status = '1'  - status is numeric column, but it's treated as string here) from the error log.
-------
Steps to reproduce: 
Just start some process instance and go to process instances persp. to display it.

Comment 8 Neus Miras 2015-11-23 09:07:26 UTC
The query creation has been modified using Integer instead String.
The commits related:
6.3.x
https://github.com/droolsjbpm/jbpm-console-ng/commit/43facbbeb448f16e8c4c1085cbfc2ac00a2ae475

master:
https://github.com/droolsjbpm/jbpm-console-ng/commit/5a88172c5dfbabb3c9835abc02e154c536fb5444

Comment 9 Jan Hrcek 2015-12-02 15:55:41 UTC
The issue has been fixed! Verified with BPM Suite 6.2.0 CR2