SQL database - querying with foreign characters and saving blob data

I have a C++ application that connects to a Firebird SQL database. The database is using UTF8 as its character set.

The database contains tables that have strings that are of type varchar and contains blob data that is of type 'blob sub_type 1'

Originally the connection to the database did not specify the character set but this was causing a Malormed String SQL error when I tried to do a query that contained a foreign character like É. I added CHARSET=UTF8 to the connection string which solved my initial problem when querying with a foreign character but now I get an SQL error when I try to save blob data.

Does anyone have any suggestions of what I should do. Any help is appreciated.
WestCoast_BCAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lcohanDatabase AnalystCommented:
What is the actual error you are getting - could you please post it here explicitly (well scramble any sensitive info if exists)?
Also, how's the "blob" defined at the database column level? I mean is it binary BLOB or some BLOB SUB_TYPE TEXT?
WestCoast_BCAuthor Commented:
I have a simpler example that is causing the same error. I have a table with a column called Details which is defined as:
DETAILS varchar(261) COLLATE UNICODE

Open in new window

If I try to do the following query:
SELECT a.DETAILS
FROM MODHISTORY a 
WHERE
    a.DETAILS LIKE '%Â%'

Open in new window

I get the error:
Error: *** IBPP::SQLException ***
Context: Statement::Prepare( SELECT a.DETAILS
FROM MODHISTORY a 
WHERE
    a.DETAILS LIKE '%Â%'
 )
Message: isc_dsql_prepare failed

SQL Message : -104
Invalid token

Engine Code    : 335544849
Engine Message :
Malformed string

Open in new window

WestCoast_BCAuthor Commented:
I am hoping someone might have a suggestion for me regarding how to solve this.
SolarWinds® Network Configuration Manager (NCM)

SolarWinds® Network Configuration Manager brings structure and peace of mind to configuration management. Bulk config deployment, automatic backups, change detection, vulnerability assessments, and config change templates reduce the time needed for repetitive tasks.

phoffric\Commented:
>> Also, how's the "blob" defined at the database column level? I mean is it binary BLOB or some BLOB SUB_TYPE TEXT?

Maybe your answer to this question will help.
WestCoast_BCAuthor Commented:
The blob is defined as:
DATA blob sub_type 1 CHARACTER SET ASCII,

Open in new window

WestCoast_BCAuthor Commented:
I have solved my problem by binding the parameters and now everything works fine

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.