Forum Discussion
Access ODBC does not recognize automatic client reroute
- bubba35Aug 30, 2021Copper ContributorYes. Normally Access connects to the database with no issues. With the ACR parameters defined, I can still access the primary database with no issues. However to attempt to test ACR, I changed the port number in db2dsdriver.cfg and db2cli.ini, for the primary database, to a bad port number, to make the primary database inaccessible, so ACR would take over and connect to the alternate database. At that, it does successfully connect to the alternate database when using db2cli. However, it doesn't in Access. Thanks!
- George_HepworthAug 30, 2021Silver Contributor
What that tells us, then, is that this is not a viable method for ODBC Access connections. It also tells you that using db2cli is a different environment where it does work.
I would, therefore, look at an alternate approach which doesn't rely on trying to use this approach as is.
What I would do instead is create a function in VBA that tries to connect to your primary database using the default parameters. If that succeeds, you should then be able to proceed on to work because Access will cache that successful connection for the remainder of the session. However, if it fails in this function, your code would then try the alternate connection. Again, if that succeeds, you are good to go. In other words, instead of trying to make the fall-back inside one config and ini, create two versions and let Access try them in turn before settling on the one to be used for a given session.
Look at this discussion (which uses MySQL) for a pattern that could be modified to this purpose.
I realize that it's less than ideal, but sometimes getting the job done takes precedence.
- bubba35Aug 31, 2021Copper ContributorWow, very good stuff there. Thanks George, I will look into this option.