Primitive failed calling 'ODBCLibraryName':SQLAllocEnv from PlatformFunction>>#callWithArguments: due to OS error126

397 views
Skip to first unread message

Louis LaBrunda

unread,
Apr 9, 2014, 6:12:37 PM4/9/14
to va-sma...@googlegroups.com

Hi,

I have a GUI program that I'm upgrading from V8.0.3 to V8.6.  It runs okay in the development environment but has this error:

Runtime error: Primitive failed calling 'ODBCLibraryName':SQLAllocEnv from PlatformFunction>>#callWithArguments: due to OS error126

at runtime.  I expect a packaging problem but it's late and time for dinner.  I'm hoping someone will post an idea by the time I get back here tomorrow.

Lou


Richard Sargent

unread,
Apr 9, 2014, 9:08:55 PM4/9/14
to va-sma...@googlegroups.com
On Wednesday, April 9, 2014 3:12:37 PM UTC-7, Louis LaBrunda wrote:
Runtime error: Primitive failed calling 'ODBCLibraryName':SQLAllocEnv from PlatformFunction>>#callWithArguments: due to OS error126

at runtime.  I expect a packaging problem but it's late and time for dinner.  I'm hoping someone will post an idea by the time I get back here tomorrow.


126 refers to a DLL load error. There was another thread a few months ago about how to find out which DLL didn't load, using different Windows calls. (If you're not using Windows, that will be problematic.)

The DLL is either the one needed for the PlatformFunction in question of something it needs to load. So, it could be the absence of the DLLs in your runtime directory, the absence of the directory from the path, or something like that.


I hope your dinner was good!
 

Joachim Tuchel

unread,
Apr 10, 2014, 12:03:36 AM4/10/14
to va-sma...@googlegroups.com
Lou,

OS Error 126 means an external lib cannot be found. You should check what Richard suggests. Another possible cause: did you deploy with an ini file o'from 8.0.3 which misses the stanza whith lib name mappings?

I think it is quite unlikely that it's a packaging problem.

Joachim

Joachim Tuchel

unread,
Apr 10, 2014, 12:14:07 AM4/10/14
to va-sma...@googlegroups.com
Lou,

I remember getting into troubles with SqlAllocEvent on Linux. The funny thing was that I somehow found out VA assumed I was using an ANCIENT version of ODBC, because in current versions, another API call should be used. The thing even felt stranger because i was using the db2 cli driver.

I am desperately trying to remember how exactly the issue was solved. It was an envirenment issue, some libs missing on my Linux box or such.

So do you see this on windows or Linux?

Joachim

Michael LaMantia

unread,
Apr 10, 2014, 3:54:40 PM4/10/14
to va-sma...@googlegroups.com
Check to make sure that your .ini file for your packaged image includes the [PlatformLibrary Name Mappings] section.  Check your abt.ini file for the appropriate values to put in this section, as I have found that in packaging, they are not automatically put into the ini file.

Mike

Louis LaBrunda

unread,
Apr 11, 2014, 9:35:26 AM4/11/14
to va-sma...@googlegroups.com

Hi Everybody,

Thank you all for the posts and very fast response.  After dinner on Wednesday (it wasn't bad Richard - thanks) and before I got back to my computer Thursday morning, I concluded it may be a missing DLL but I had included everything Instantiations supplies in their server zip, so didn't quite make sense.

Joachim hinted at the answer but I wasn't quite sure what he meant.  I tried what Mike suggested and that did the trick.

Thank you all again.

Lou

Joachim Tuchel

unread,
Apr 11, 2014, 1:15:04 PM4/11/14
to va-sma...@googlegroups.com
Hi Lou,

so we've learned that we need to take a look at the ini file provided with new versions ;-) 
I made the plan to always use an ini from the dev image with a new version and modify that instead of using the old ini for a new runtime.

Joachim

Mariana Matos

unread,
May 17, 2017, 8:56:56 AM5/17/17
to VA Smalltalk
Hi, I'm reviving this thread because I have a similar problem.

I'm trying to migrate from an older version of Smalltalk (trying to get rid of a deprecated VA6) and I'm getting this error:

Walkback: Primitive failed calling 'DB2CliLibraryName':SQLAllocEnv from PlatformFunction>>#callWithArguments: due to OS error126

The application indeed uses a DB2 database and fails when it first attempts to connect to it. At first there was no ini file in the runtime directory and I got this error, so I copied one and renamed it accordingly to match the package name.

This ini file already had the following under the PlatformLibrary Name Mappings section:
DB2CliLibraryName=db2cli

But still I get the same error as before.

I checked and there is a file named db2cli.dll under the DB2 bin directory (which is part of the PATH environment variable, so it's not like DB2 is incorrectly installed or something).

Also, when I run the application using a VA6 built runtime in the same machine (without an ini file), this issue does not happen.

I have also tried changing the ini to use db2cli64, since the machine I'm trying to run this on is 64 bits, but apparently the executable runs as 32 bits, so that didn't solve it, it just led to a similar dll issue with OS error193.

Anyway, I'm really stuck here and I've been pushing to migrate to newer VA versions for a really long time. I'd hate to have to continue working on VA6 because of this. Any ideas will be greatly appreciated!

Thanks,

Mariana

Louis LaBrunda

unread,
May 17, 2017, 9:35:10 AM5/17/17
to VA Smalltalk
Hi Mariana,

Do you have these four lines in your .ini file:

DB2CliLibraryName=db2cli
DB2PrecompilerServices=db2aprep
DB2RuntimeServices=db2app
DB2RuntimeServicesMessages=db2agapi

Somewhere between version 6 and version 8.6.3 Instantiations removed direct references to .ini file names from the image (and maybe other places) and now links them up via the .ini file.  Since things work with your version 6, I think we can assume the needed files are present and that the problem lies in finding them.  So the .ini files seems like the place to look.  If you have those four lines or add them and still have problems, post back and we will see what else we can come up with.

Lou

Mariana Matos

unread,
May 17, 2017, 12:27:13 PM5/17/17
to VA Smalltalk
Yes, I have those 4 lines in the .ini file.

And since I tried changing it to use the 64 bit version (which failed for different reasons), I was able to confirm that it was being picked up.

Louis LaBrunda

unread,
May 17, 2017, 2:11:09 PM5/17/17
to VA Smalltalk
Hi Mariana,

My next guess would be that one or more of these DLLs; db2cli.dll, db2aprep.dll, db2app.dll and db2agapi.dll aren't being found.  Can you try coping them to the same folder and the executable.  If things work then, they are in the wrong place of there is a problem with a path setup.

Lou

Santiago Cardoso Geller

unread,
May 17, 2017, 2:16:55 PM5/17/17
to va-sma...@googlegroups.com
Hello Mariana. Here we have the same error after migration from VAST 6.0.4 to VA Smalltalk 8.6.3.

I didn't take the time to analyze how the library name is initialized from the .ini file, but you can try to replace method AbtIbmCliDatabaseManager class>>#libraryName with the following:

libraryName
"Answer the logical name for the library."

^ 'db2cli' "$NON-NLS$"

and do the reduce again. This will work just for windows. Is not the final solution, but is a point to start the analysis.
In VAST 6.0.4 the libraryName is resolved starting from AbtDatabaseManager class>>#selectLibraryName: 

I couldn't see how the name is initialized from abt.ini, since there's no other reference to string 'DB2CliLibraryName' in the image. I will continue look for that.

Regards,
Santiago



--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk+unsubscribe@googlegroups.com.
To post to this group, send email to va-sma...@googlegroups.com.
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.

Mariana Matos

unread,
May 18, 2017, 9:13:20 AM5/18/17
to VA Smalltalk
After copying dlls back and forth with no luck I realized this morning that the problem was hiding at plain sight... the ini file was actually incorrectly named, since the extension was not shown the files was named wwace11.ini.ini instead of wwace11.ini.

I corrected it and the application launched ok at last!

Thanks all for the replies!
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages