xsharp.eu • adsini_path environment variable
Page 1 of 1

adsini_path environment variable

Posted: Mon Oct 02, 2023 2:10 pm
by wriedmann
Hello,
on a customers site I have two different networks: one open to the internet, the other not. Both have the same ADS server, but with a different IP address.
To make ADS work in this environment, I need to differentiate the ads.ini.
In VO, the following code works:

Code: Select all

local cIPAddress as string
local cAdsIniLoc as string
	
cIPAddress := AllTrim( GetIPAddress( "alpilx" ) )
if ! cIPAddress == ""
  cAdsIniLoc := oSysIni:GetStringCheck( "Settings", "AdsIniLoc_" + cIPAddress, "g:\alpifakt\192.168.1.0" )
  SetEnvironmentVariable( String2PSZ( "adsini_path" ), String2PSZ( cAdsIniLoc ) )
endif
The X# code is this:

Code: Select all

local oHostEntry as System.Net.IPHostEntry
local oIpAddress as System.Net.IPAddress
local cAdsIniLoc as string

oHostEntry := System.Net.DNS.GetHostEntry( ProgSettings.DatabaseConnectionInfo:ServerName )
if oHostEntry:AddressList:Length > 0
  oIpAddress := oHostEntry:AddressList[1]
  cAdsIniLoc := ProgSettings.SysIni:GetStringCheck( "Settings", "AdsIniLoc_" + oIpAddress:ToString(), "g:\alpifakt\192.168.1.0" )
  Environment.SetEnvironmentVariable( "adsini_path", cAdsIniLoc, EnvironmentVariableTarget.Process )
endif
Unfortunately this code does works, it seems that the X# RDD does not respects that setting.

The ADS help file has the following text about this functionality:

Code: Select all

Windows

In order for the ads.ini file to be used, it must be located in the application directory, the Windows directory, the Windows System directory, or the client's search path.

In addition, if an environment variable exists with the name adsini_path, that path will be used to locate the ads.ini file. This can be helpful when you do not want to modify the application’s search path, but still need the ads.ini file to exist in a directory multiple users have rights to (for example on Windows Vista installations). An application can often set the environment variable at run-time before calling any Advantage functions, which avoids the need to set a per-workstation environment variable.
Thank you very much for any help!

Wolfgang

Re: adsini_path environment variable

Posted: Mon Oct 02, 2023 4:09 pm
by robert
Wolfgang,
I am not sure what we can do about this.
The whole ads.ini handling and ads_initpath is handled inside the ADS DLLs.
I checked the ADS RDD for Vulcan and cannot find anything related

Robert

Re: adsini_path environment variable

Posted: Mon Oct 02, 2023 5:20 pm
by wriedmann
Hi Robert,
thank you very much for checking!
Wolfgang