[Lazarus] freetds + lazarus cannot get around "some character(s) could not be converted" error

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] freetds + lazarus cannot get around "some character(s) could not be converted" error

Free Pascal - Lazarus mailing list
I am attempting to write a Lazarus program using a TMSSQLConnection on Linux (Ubuntu 16.04 64 bit) with FreeTDS. Whenever I try to apply updates on my TSQLQuery component and commit the transaction on its associated TSQLtransaction component I receive this error:

An error occurred while applying the updates in a record: Connection : Error 2403 :
Attempt to initiate a new Adaptive Server operation with results pending
Some character(s) could not be converted into client's character set.  Unconverted bytes were changed to question marks ('?')
Some character(s) could not be converted into client's character set.  Unconverted bytes were changed to question marks ('?')
Some character(s) could not be converted into client's character set.  Unconverted bytes were changed to question marks ('?')
Some character(s) could not be converted into client's character set.  Unconverted bytes were changed to question marks ('?')
.

Press OK to ignore and risk data corruption.
Press Abort to kill the program

If I press OK the updates are not actually applied. It looks like no matter what I do I cannot edit field values and have them applied to the SQL server database.

I have tried changing the freetds.conf file to include the following:

[global]
client charset = UTF-8

And when I use the tsql command in a Linux terminal with my server I get the following:

tsql -H <server_name> -p 1433 -U <user_name>
Password:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> exit

I have even tried setting the charset property on the TMSSQLConnection to UTF-8.

End the end all my attempts result in the same thing. I get that error message when I apply and commit, and no changes are applied on the actual database.

Does anyone have any suggestions?


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] freetds + lazarus cannot get around "some character(s) could not be converted" error

Free Pascal - Lazarus mailing list

Hello,


I am attempting to write a Lazarus program using a TMSSQLConnection on Linux (Ubuntu 16.04 64 bit) with FreeTDS. Whenever I try to apply updates on my TSQLQuery component and commit the transaction on its associated TSQLtransaction component I receive this error:

An error occurred while applying the updates in a record: Connection : Error 2403 :
Attempt to initiate a new Adaptive Server operation with results pending
Some character(s) could not be converted into client's character set.  Unconverted bytes were changed to question marks ('?')
Some character(s) could not be converted into client's character set.  Unconverted bytes were changed to question marks ('?')
Some character(s) could not be converted into client's character set.  Unconverted bytes were changed to question marks ('?')
Some character(s) could not be converted into client's character set.  Unconverted bytes were changed to question marks ('?')
.

Press OK to ignore and risk data corruption.
Press Abort to kill the program

If I press OK the updates are not actually applied. It looks like no matter what I do I cannot edit field values and have them applied to the SQL server database.

I have tried changing the freetds.conf file to include the following:

[global]
client charset = UTF-8

probably try add also:

dump file = freetds.log

then you can look into log file what and when actually happens ...



I have even tried setting the charset property on the TMSSQLConnection to UTF-8.

Yes it is needed

What verision of FPC/Lazarus do you use?
Do you have DefaultSystemCodePage = UTF8 ?
Can you try with TRUNK or 3.2 branch?

What is version of remote SQL Server ?

-Laco.



--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] freetds + lazarus cannot get around "some character(s) could not be converted" error

Free Pascal - Lazarus mailing list
Laco,

I set the SetMultiByteConversionCodePage(65001) and it worked. Then I removed it and it still worked. The only thing that has changed is that I've rebooted since editing the tds configuration files, so maybe that was the problem.

Thanks for responding.

Anthony

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] freetds + lazarus cannot get around "some character(s) could not be converted" error

Free Pascal - Lazarus mailing list


On Tue, 30 Jul 2019, Anthony Walter via lazarus wrote:

> Laco,
>
> I set the SetMultiByteConversionCodePage(65001) and it worked. Then I
> removed it and it still worked. The only thing that has changed is that
> I've rebooted since editing the tds configuration files, so maybe that was
> the problem.
>
> Thanks for responding.

Maybe this kind of info can be added to the  Wiki.
https://wiki.freepascal.org/SqlDBHowto
seems like a good location...

Michael.
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus