Access ODBC does not recognize automatic client reroute

%3CLINGO-SUB%20id%3D%22lingo-sub-2688454%22%20slang%3D%22en-US%22%3EAccess%20ODBC%20does%20not%20recognize%20automatic%20client%20reroute%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2688454%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20have%20an%20ODBC%20connection%20to%20a%20DB2%2FLUW%20database%20in%20MS%2FAccess%20(2016)%20and%20am%20trying%20to%20implement%20ACR%20(Automatic%20Client%20Reroute).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20added%20the%20following%20(bold)%20to%20my%20db2dsdriver.cfg%20file%3A%3C%2FP%3E%3CP%3E%3CDATABASE%20name%3D%22%26quot%3BMYDBASE%26quot%3B%22%20host%3D%22%26quot%3BDBHOST1%26quot%3B%22%20port%3D%22%26quot%3B60000%26quot%3B%22%3E%3C%2FDATABASE%3E%3C%2FP%3E%3CP%3E%3CPARAMETER%20name%3D%22%26quot%3Bhostname%26quot%3B%22%20value%3D%22%26quot%3BDBHOST1%26quot%3B%2F%22%3E%3C%2FPARAMETER%3E%3C%2FP%3E%3CP%3E%3CPARAMETER%20name%3D%22%26quot%3Bport%26quot%3B%22%20value%3D%22%26quot%3B60000%26quot%3B%2F%22%3E%3C%2FPARAMETER%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CPARAMETER%20name%3D%22%26quot%3BAltHostName%26quot%3B%22%20value%3D%22%26quot%3BDBHOST2%26quot%3B%2F%22%3E%3C%2FPARAMETER%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CPARAMETER%20name%3D%22%26quot%3BAltPort%26quot%3B%22%20value%3D%22%26quot%3B60000%26quot%3B%2F%22%3E%3C%2FPARAMETER%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CACR%3E%3C%2FACR%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CPARAMETER%20name%3D%22%26quot%3BenableAcr%26quot%3B%22%20value%3D%22%26quot%3Btrue%26quot%3B%2F%22%3E%3C%2FPARAMETER%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CPARAMETER%20name%3D%22%26quot%3BmaxAcrRetries%26quot%3B%22%20value%3D%22%26quot%3B10%26quot%3B%2F%22%3E%3C%2FPARAMETER%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CPARAMETER%20name%3D%22%26quot%3BacrRetryInterval%26quot%3B%22%20value%3D%22%22%3E%3C%2FPARAMETER%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CPARAMETER%20name%3D%22%26quot%3BenableseamlessACR%26quot%3B%22%20value%3D%22%26quot%3Btrue%26quot%3B%2F%22%3E%3C%2FPARAMETER%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CPARAMETER%20name%3D%22%26quot%3BenableAlternateServerListFirstConnect%26quot%3B%22%20value%3D%22%26quot%3Btrue%26quot%3B%2F%22%3E%3C%2FPARAMETER%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CALTERNATESERVERLIST%3E%3C%2FALTERNATESERVERLIST%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSERVER%20name%3D%22%26quot%3Botherserver%26quot%3B%22%20hostname%3D%22%26quot%3BDBHOST2%26quot%3B%22%20port%3D%22%26quot%3B60000%26quot%3B%2F%22%3E%3C%2FSERVER%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20tested%20this%20on%20my%20machine%20and%20it%20successfully%20falls%20over%20to%20the%20alternate%20server%20when%20the%20primary%20server%20is%20unavailable.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20when%20I%20attempt%20to%20connect%20to%20the%20database%20in%20MS%2FAccess%2C%20I%20get%20a%20connectivity%20error%20(SQL30081N)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHas%20anyone%20worked%20with%20MS%2FAccess%20and%20ACR%3F%20Thanks!%3C%2FP%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2688454%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E2016%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAccess%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EACR%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDB2%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EODBC%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2692138%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20ODBC%20does%20not%20recognize%20automatic%20client%20reroute%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2692138%22%20slang%3D%22en-US%22%3EDoes%20the%20connection%20work%20if%20you%20DO%20NOT%20try%20to%20include%20the%20automatic%20reroute%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2698429%22%20slang%3D%22en-US%22%3ERe%3A%20Access%20ODBC%20does%20not%20recognize%20automatic%20client%20reroute%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2698429%22%20slang%3D%22en-US%22%3EYes.%20Normally%20Access%20connects%20to%20the%20database%20with%20no%20issues.%20With%20the%20ACR%20parameters%20defined%2C%20I%20can%20still%20access%20the%20primary%20database%20with%20no%20issues.%20However%20to%20attempt%20to%20test%20ACR%2C%20I%20changed%20the%20port%20number%20in%20db2dsdriver.cfg%20and%20db2cli.ini%2C%20for%20the%20primary%20database%2C%20to%20a%20bad%20port%20number%2C%20to%20make%20the%20primary%20database%20inaccessible%2C%20so%20ACR%20would%20take%20over%20and%20connect%20to%20the%20alternate%20database.%20At%20that%2C%20it%20does%20successfully%20connect%20to%20the%20alternate%20database%20when%20using%20db2cli.%20However%2C%20it%20doesn't%20in%20Access.%20Thanks!%3C%2FLINGO-BODY%3E
New Contributor

Hi,

I have an ODBC connection to a DB2/LUW database in MS/Access (2016) and am trying to implement ACR (Automatic Client Reroute).

 

I have added the following (bold) to my db2dsdriver.cfg file:

<database name="MYDBASE" host="DBHOST1" port="60000">

<parameter name="hostname" value="DBHOST1"/>

<parameter name="port" value="60000"/>

<parameter name="AltHostName" value="DBHOST2"/>

<parameter name="AltPort" value="60000"/>

<acr>

<parameter name="enableAcr" value="true"/>

<parameter name="maxAcrRetries" value="10"/>

<parameter name="acrRetryInterval" value"1"/>

<parameter name="enableseamlessACR" value="true"/>

<parameter name="enableAlternateServerListFirstConnect" value="true"/>

<alternateserverlist>

<server name="otherserver" hostname="DBHOST2" port="60000"/>

</alternateserverlist>

</acr>

</database>

 

I have tested this on my machine and it successfully falls over to the alternate server when the primary server is unavailable.

 

However, when I attempt to connect to the database in MS/Access, I get a connectivity error (SQL30081N)

 

Has anyone worked with MS/Access and ACR? Thanks!

4 Replies
Does the connection work if you DO NOT try to include the automatic reroute?
Yes. 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!

@bubba35 

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.

Wow, very good stuff there. Thanks George, I will look into this option.