Driver loading issue when connecting to PostgreSQL after connecting to Oracle
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
Zeos8 r7018 Android won't compile !!!
-V -VN --description:"Zeos Plain Database API" -NO.\Android\Debug ZPlain.dpk
[DCC Error] ZPlainLoader.pas(203): E2003 Undeclared identifier: 'LoadLibraryEx'
[DCC Error] ZPlainLoader.pas(203): E2003 Undeclared identifier: 'LOAD_WITH_ALTERED_SEARCH_PATH'
[DCC Fatal Error] ZPlainDriver.pas(705): F2063 Could not compile used unit 'ZPlainLoader.pas'
Failed
Michal
-V -VN --description:"Zeos Plain Database API" -NO.\Android\Debug ZPlain.dpk
[DCC Error] ZPlainLoader.pas(203): E2003 Undeclared identifier: 'LoadLibraryEx'
[DCC Error] ZPlainLoader.pas(203): E2003 Undeclared identifier: 'LOAD_WITH_ALTERED_SEARCH_PATH'
[DCC Fatal Error] ZPlainDriver.pas(705): F2063 Could not compile used unit 'ZPlainLoader.pas'
Failed
Michal
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
Now it's compiling - Zeos8 r7019
Michał
Michał
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
@both constributors,
i just added a fallback using a define. I'm not aware how to resolve the issue on other platforms except using the default code. Let's wait for a new ticket or forum thread. Anyway thank's for your help and support!
i just added a fallback using a define. I'm not aware how to resolve the issue on other platforms except using the default code. Let's wait for a new ticket or forum thread. Anyway thank's for your help and support!
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
@Egonhugeist,
Which platform was missing it except Android? My original idea was to define the LoadLibraryEx method for these (if they have it) or create one, pointing to the original LoadLibrary method.
Anyway, conditional splitting is also fine if you know which platforms need the extra care :)
Which platform was missing it except Android? My original idea was to define the LoadLibraryEx method for these (if they have it) or create one, pointing to the original LoadLibrary method.
Anyway, conditional splitting is also fine if you know which platforms need the extra care :)
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
Hi Michael,
Lazarus 2.0.6-64 on Linux(x86) had no problem with build r7018.
Only Delphi 10.3.3 with Android had a problem.
Michal
Lazarus 2.0.6-64 on Linux(x86) had no problem with build r7018.
Only Delphi 10.3.3 with Android had a problem.
Michal
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
I've tested the fix (latest r7020) on all my drivers and it seems to work perfectly, completely solving the original problem. I tested:
Oracle clients (11, 12, 19)
PostgreSQL
MySQL
Firebird
Tested on both 32bit and 64bit, Windows 10, Delphi 10.4. Thanks for the fix!
-Mark
Oracle clients (11, 12, 19)
PostgreSQL
MySQL
Firebird
Tested on both 32bit and 64bit, Windows 10, Delphi 10.4. Thanks for the fix!
-Mark
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
@Mark, thanks for confirmation! That's allways helpful.
@aehimself all platforms except UNIX such as
DARWIN (OSx)
ANDROID [ANDROID32,ANDROID64]/Delphi AARACH64/FPC
etc.
so it's not worth it bypassing the issue by reimplementing the Windows idea of LoadLibrayEx.
As i said: We're happy the issue is resolved and i perfectly can live with the {$IF declared(LoadLibraryEx)} define. The more FPC has its own DynLib unit(added to Zeos by Marco Van De Voort/FPC core) and i wouldn't take a look to all the hidden FPC .inc files(compile target related) as long nobody reports similar problems.
From my side the case is close and i thank you all for your support!
@aehimself all platforms except UNIX such as
DARWIN (OSx)
ANDROID [ANDROID32,ANDROID64]/Delphi AARACH64/FPC
etc.
so it's not worth it bypassing the issue by reimplementing the Windows idea of LoadLibrayEx.
As i said: We're happy the issue is resolved and i perfectly can live with the {$IF declared(LoadLibraryEx)} define. The more FPC has its own DynLib unit(added to Zeos by Marco Van De Voort/FPC core) and i wouldn't take a look to all the hidden FPC .inc files(compile target related) as long nobody reports similar problems.
From my side the case is close and i thank you all for your support!
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
Good, happy to hear! And with your request a 3 year old bug report was closed, so thank you! :)
Expected. I only have Delphi Win32/64, I relied on Zeos tests to reveal any compile/behavior breaks. So.... FPC/Lazarus doesn't have LoadLibraryEx? That's a shame. It would worth to define it (even in the same unit) on Windows platforms or else FPC will be still affected by the exactly same "misloading" as Delphi was, before.EgonHugeist wrote: ↑29.10.2020, 19:33DARWIN (OSx)
ANDROID [ANDROID32,ANDROID64]/Delphi AARACH64/FPC
etc.
Understandable. Zeos is pretty old and pretty large. Noone wants those wardrobes open, just to release a ton of skeletons!!!EgonHugeist wrote: ↑29.10.2020, 19:33and i wouldn't take a look to all the hidden FPC .inc files(compile target related) as long nobody reports similar problems.
As I already mentioned I feel really good if finally I can give something back to this awesome component. Special thanks to Mark for the ExpandFileName tip!EgonHugeist wrote: ↑29.10.2020, 19:33From my side the case is close and i thank you all for your support!
But not so fast! There is one question left for you, Michal.
Do you think it could be done?
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
-
- Platinum Boarder
- Posts: 1962
- Joined: 17.01.2011, 14:17
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
@aehimself,
of course it can be done. Yet it has a low priority for me. Propose you open a feature request ticket: https://sourceforge.net/p/zeoslib/internaltickets/ so we won't forget it.
of course it can be done. Yet it has a low priority for me. Propose you open a feature request ticket: https://sourceforge.net/p/zeoslib/internaltickets/ so we won't forget it.
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
I just wanted to chime in and mention that since the fix to the dll loading stuff I don't have an actual need for unloading the driver dlls. I really brought it up in case it was something that already existed or something I could use to diagnose/workaround the loading issue. Thanks, as always!
-Mark
-Mark
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
I'm sorry to say this, but it's not about you, nor your request :) It's a really inconvenient way of optimization (?) to keep the library connections open until the application is closed. I don't know how it is being handled, but if a new handle is opened each time a connection is opened but not closed afterwards, your application will crash due to handle / memory outage if it is connecting / disconnecting rapidly.
For me it's annoying because if I want to update library DLLs I have to close my app down.
But yeah, this is something I'd LOVE to see in Zeos.
Delphi 12.2, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Using:
- MySQL server 8.0.18; libmysql.dll 8.0.40 x64 5.7.19 x68, libmariadb.dll 3.3.11
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.15
- MSSQL 2012, 2019; sybdb.dll FreeTDS_3102
- SQLite 3.47
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
> I'm sorry to say this, but it's not about you, nor your request
My wife said the same thing!
-Mark
My wife said the same thing!
-Mark
-
- Platinum Boarder
- Posts: 1962
- Joined: 17.01.2011, 14:17
Re: Driver loading issue when connecting to PostgreSQL after connecting to Oracle
No matter how many times LoadLibrary is called, Windows only loads single instance of a lib. Different handles just point to the same object. Moreover, FreeLibrary cares about ref counter as well. So it's enough for driver object to call FreeLibrary on destroy.