Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not open table with primary key of type VarChar in utf8 format [ODBC124] #121

Closed
firebird-automations opened this issue May 22, 2011 · 29 comments

Comments

@firebird-automations
Copy link

Submitted by: Thomas Schwarzmüller (blacky)

Attachments:
Firebird_ODBC_2.0.2.153_Win32.exe
Firebird_ODBC_2.0.2.153_x64.exe
msaccess.patch

I like to open a Firebird Database with MS Access 2007. The connection works.
But when I open a table which primary key is of type VarChar, all data fields show "#⁠deleted".
The database has utf8 format.
Error doesn't occur with:
- Tables with non text primary keys.
- Databases with other text formats (like ISO8859_1)

@firebird-automations
Copy link
Author

Commented by: @alexpotapchenko

I think it is not Firebird ODBC problem.
Please read this - http://www-stage2.ingres.com/kb/article/418033

@firebird-automations
Copy link
Author

Commented by: Thomas Schwarzmüller (blacky)

I did some more analysis.
It's a known bug in MS Access, but the Easysoft ODBC driver fixed it with the option "Default SQL_CHAR".

Someone told me, he took your source code and just changed the return value to SQL_C_CHAR instead of SQL_C_WCHAR. Now it works. Unfortunately he did it only for a 64-Bit Version and I don't have the tools to do the same for a 32-Bit Version. Would anyone be willing to do this ?

@firebird-automations
Copy link
Author

Commented by: @alexpotapchenko

The attached 32-bit driver with this fix.

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

Attachment: OdbcFb.zip [ 11973 ]

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

priority: Blocker [ 1 ] => Major [ 3 ]

@firebird-automations
Copy link
Author

Commented by: Thomas Schwarzmüller (blacky)

Wonderful !
It works.
Thank you very much.

@firebird-automations
Copy link
Author

Commented by: Thomas Schwarzmüller (blacky)

Hello Alexander,
I don't know if this is the right way to contact you, but didn't find another.

Do you remember the issue above ODBC124.
You fixed the ODBCDriver Version 2.0.0 in 32-Bit and it worked well all the time.
Now I have a Windows 7 64-Bit Installation and it Shows the same problem.
Would it be possible to fix this Problem in the latest ODBCVersion of 64-Bit also ?

Best Regards
Thomas

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

Attachment: OdbcFb.zip [ 11973 ] =>

@firebird-automations
Copy link
Author

Commented by: @alexpotapchenko

The latest ODBC driver versions with this fix in attachment.

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

Attachment: Firebird_ODBC_2.0.2.153_Win32.exe [ 12340 ]

Attachment: Firebird_ODBC_2.0.2.153_x64.exe [ 12341 ]

@firebird-automations
Copy link
Author

Commented by: Thomas Schwarzmüller (blacky)

Your Support is unbelievable.
Thank you so much.

@firebird-automations
Copy link
Author

Commented by: Chris Sproß (chris63684)

Hello Alexander,

I hope this is the right way to contact you about this issue. I too am facing the #⁠deleted problem when using a char(3) as primary key. I found this issue ODBC124 here and hoped that the special version you attached would work, but with this version, Access 2003 and Firebird 3.0.2.32703 (64 bit) I receive the error "[ODBC Firebird Driver][Firebird]Attempt to reclose a closed cursor (#⁠-501)" when I try to connect to the ODBC source from Access. Using your newest ODBC Driver with version 2.0.5.156 works fine (apart from the #⁠deleted problem).

Is there maybe something obvious I'm missing? If not, would it be possible for you to fix this problem in the newest Version like you did before?

Best regards

Chris

Edit: Since I have written this I have compiled the sources with Visual Studio Community and the driver works apart from the #⁠deleted problem. I would actually be more interested in what parts of the code you changed to make it work with Access so that I can then make the modifications myself when a new version of the driver is released.

@firebird-automations
Copy link
Author

Commented by: @alexpotapchenko

Hi Chris,

I have attached patch for this issue, there is small change in OdbcStatement.cpp.

@firebird-automations
Copy link
Author

Modified by: @alexpotapchenko

Attachment: msaccess.patch [ 13181 ]

@firebird-automations
Copy link
Author

Commented by: Chris Sproß (chris63684)

Thank you very very much.

It's almost working now: Access now correctly shows the records, but only if the primary key doesn't contain umlauts (äöü). I'm guessing that the database supplies a unicode string, the driver tells access that it's an ascii or ansi string and thus the umlauts don't get converted. I'll try and see if I can add that implementation myself, but it's a lot of code.
----------------

For anyone reading about this in the future and not knowing how to build this version from source yourself:
You can download "Visual Studio Community" for free, upgrade the MsVc90.win project of the driver with it and make three changes to make it compile successfully.
Change these things in the options of the project:

1) in the C/C++ overview change the Include path for your Firebird installation (mine is "C:\Program Files\Firebird\Firebird_3_0\include", was set to "C:\Program Files\Firebird\include")

2) in Linker->Input you have to add "legacy_stdio_definitions.lib" to the Additional Dependencies or otherwise the linking of the dll will fail because they changed the sprintf functions to inline.

3) there are a couple of lines that won't compile that look like this: r = appendString(r, ";"SETUP_DRIVER"=");
Just change them to this:
r = appendString(r, ";"); r = appendString(r, SETUP_DRIVER"=");

After that it should compile and you can apply Alexander's patch (which you can do manually. It's just a few lines).

@MicheleFire2022
Copy link

Hi Guys, can i have the ODBC patched for ms access? i can't find the attach to this tread

Thanks a lot
Br

@MicheleFire2022
Copy link

with this fix in attachment

I have the problem that MS Access show me all results deleted ... The Firebird server has UTF8 char set but i can't change this parameter

Br

@jabrugger
Copy link

@irodushka This issue still persists on 3.0.1 (22/dec/2023) build.
Would be great to get it fixed also.

@irodushka
Copy link

irodushka commented Dec 22, 2023 via email

@jabrugger
Copy link

Yes, the 2.0.5 build has this issue too.
Attached is a script which generates this issue when browsing the table from MS Access.
Firebird ODBC #121.zip

irodushka added a commit to irodushka/firebird-odbc-driver that referenced this issue Dec 26, 2023
Driver detects MSAccess automatically and applies the patch.
@irodushka
Copy link

irodushka commented Dec 26, 2023

Hi @jabrugger
I made a fix in the last build, you can try it.
This version magically detects that it's loaded from MSAccess and applies a patch))) So you don't need a special ODBC driver build. Hope it will work ok.

@jabrugger
Copy link

@irodushka It seems to work fine! Thank you so much!
If I find a problem I'll let you know.

@irodushka
Copy link

irodushka commented Dec 27, 2023 via email

@MicheleFire2022
Copy link

Hi @jabrugger I made a fix in the last build, you can try it. This version magically detects that it's loaded from MSAccess and applies a patch))) So you don't need a special ODBC driver build. Hope it will work ok.

Hi , i also had the problem. Where can i find the last release with this patch?
thanks :-)

@jabrugger
Copy link

@MicheleFire2022
Copy link

thanks a lot ;-)

@MicheleFire2022
Copy link

ah.... i have an old firebird so i can't use this one :-(

@mrotteveel
Copy link
Member

ah.... i have an old firebird so i can't use this one :-(

I assume it will work with an older Firebird, as long as you use a Firebird 3.0 or higher fbclient.dll.

@irodushka
Copy link

Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants