Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !Note that the code above occasionally needs a tweak depending on the OS involved.
- !The ODBC driver naming varies from OS to OS occasionally. I worked around this
- !by digging through the registry to find the proper name for the driver so as
- !to eliminate the mystery (and the errors) on non-cooperative windows versions.
- !That code looks like this:
- qRegistryList QUEUE,PRE(my)
- RegValues STRING(40)
- END
- CODE
- getregsubkeys(REG_LOCAL_MACHINE,'SOFTWARE\WOW6432Node\ODBC\ODBCINST.INI',qRegistryList) !64 bit OS
- ud.debug('Wow6432 bit - ODBC list: records=' & records(qRegistryList))
- if records(qRegistryList) = 0
- getregsubkeys(REG_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBCINST.INI\ODBC DRIVERS',qRegistryList) !32bit
- ud.debug('64 bit - ODBC list: records=' & records(qRegistryList))
- end
- loop intL = 1 to records(qRegistryList)
- get(qRegistryList,intL)
- if instring('postgresql',lower(qRegistryList.RegValues),1,1) > 0
- if instring('unicode',lower(qRegistryList.RegValues),1,1) > 0
- GLO:PostgresOwner = 'Driver={{' & clip(qRegistryList.RegValues) |
- & '};Server='&CLIP(strServerName)&';Port=5432;Database='&CLIP(strDatabaseName) |
- & ';Uid='&CLIP(strUserName)&';Pwd='&CLIP(strUserPwd) & ';'
- break
- END
- end
- end
- ! And finally, because XP. Dont get me started:)
- strWinVersion = system{prop:WindowsVersion}
- ud.debug('system{{prop:WindowsVersion}=' & clip(strWinVersion))
- if instring('XP',clip(strWinVersion),1,1) > 0 ! or instring('2012',clip(strWinVersion),1,1) > 0 or instring('Windows 10',clip(strWinVersion),1,1) > 0
- GLO:PostgresOwner = 'Driver={{PostgreSQL UNICODE};Server='&CLIP(strServerName)&';Port=5432;Database='&CLIP(strDatabaseName) |
- & ';Uid='&CLIP(strUserName)&';Pwd='&CLIP(strUserPwd) & ';'
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement