Four Stars cjj
Four Stars

Prepared Statement issue with Character data type

Hi all,
Not sure if I'm being silly, or if I've hit a brick wall on this.
I have a tMysqlRow component that I'm setting up as a prepared statement.  I've defined the parameters (more than a dozen), but it is failing due to the lack of option for a particular parameter type.
I have a 'Character' data field in my MySQL table, and Talend is happy to define and parse this throughout the job... until this point.

As can be seen, there's no capacity to set the field type as 'Character' within the Advanced table of the tMySQL row component.  This, if set to string for example, causes the familiar error:
"The method setString(int, String) in the type PreparedStatement is not applicable for the arguments (int, Character)"
Is this something Talend has overlooked, or am I at fault?
3 REPLIES
Moderator

Re: Prepared Statement issue with Character data type

Hi,
Could you please show us your prepared statement? Screenshot of tMysqlRow will be preferred.
Can you run it successfully in your mysql client?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Ten Stars

Re: Prepared Statement issue with Character data type

setString expects a String as the second argument.  Try converting the character field in the parameter settings by using: String.valueOf(myChar)
Four Stars cjj
Four Stars

Re: Prepared Statement issue with Character data type

Thanks for the replies - not exactly on topic for what I was asking though.
My main issue was that Talend's prepared statement component does not include a relevant match for a "Character" DB type.


If you have a single character field in a MySQL DB, there is no classification within the component that will match.
Forcing the data to comply with what talend wants will still end up in an issue, as the DB does not want a String - it wants a Character!