Informix

 View Only
Expand all | Collapse all

Connecting to a high-availability cluster through IBM Informix Connection Managers

  • 1.  Connecting to a high-availability cluster through IBM Informix Connection Managers

    Posted Fri August 19, 2022 01:32 PM
    Hi,
    I have a connection problem using java applications with jdbc through IBM Informix Connection Managers
    The situation is the following:
    • I have a high-availability cluster (c1) that is composed of two servers.
    • The user name on all cluster servers is user1.
    • The password on all cluster servers is pass1.
    cm1, on host1 uses the following configuration file for client redirection and failover
    NAME cm1
    CLUSTER c1
    {
    INFORMIXSERVER g_produ
    SLA oltp_1 DBSERVERS=PRIMARY \
    WORKERS=8
    FOC ORDER=HDR PRIORITY=1
    CMALARMPROGRAM ${INFORMIXDIR}/etc/cmalarmprogram.sh
    }
    cm2, on host2 uses the following configuration file for client redirection and failover
    NAME cm2
    CLUSTER c1
    {
    INFORMIXSERVER g_produ
    SLA oltp_2 DBSERVERS=PRIMARY \
    WORKERS=8
    FOC ORDER=HDR PRIORITY=2
    CMALARMPROGRAM ${INFORMIXDIR}/etc/cmalarmprogram.sh
    }
    The sqlhost file is:
    produ_tcp group  -         -        c=1,e=oltp_2
    oltp_1 onsoctcp   host1 9910 g=produ_tcp
    oltp_2 onsoctcp   host2 9910 g=produ_tcp
    The  url  is:
    jdbc:informix-sqli://INFORMIXSERVER=produ_tcp;SQLH_TYPE=FILE;SQLH_FILE=sqlhosts;USER=user1;PASSWORD=pass1;INFORMIXCONRETRY=2;
    INFORMIXCONTIME=10;LOGINTIMEOUT=10
    when establishing the connection generates the error
    FAILED: failed to connect!
    ERROR: Invalid connection-type.
    java.sql.SQLException: Invalid connection-type.
    at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1404)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:44)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:516)
    at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:243)
    at java.sql.DriverManager.getConnection(DriverManager.java:317)
    at java.sql.DriverManager.getConnection(DriverManager.java:273)
    at CreateDB.main(CreateDB.java:65)
    Caused by: com.informix.asf.IfxASFRemoteException:
    at com.informix.asf.Connection.recvConnectionResponse(Connection.java:664)
    at com.informix.asf.Connection.establishConnection(Connection.java:1520)
    at com.informix.asf.Connection.<init>(Connection.java:395)
    at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1398)

    Note: if the informix user is used in the connection, errors are not generated




    ------------------------------
    Arnulfo Martinez Ruiz
    ------------------------------

    #Informix


  • 2.  RE: Connecting to a high-availability cluster through IBM Informix Connection Managers

    Posted Thu September 22, 2022 06:34 AM
    Edited by System Fri January 20, 2023 04:14 PM
    Arnulfo

    If the user: informix can connect to the database server using  the same connection string and sqlhosts file, then I would hazard a guess that the issue lies either with...

    • user: user1 not being able to locate the sqlhosts file
    • user: user1 not having permission to read the sqlhosts file

    ...with reference to the sqlhosts  file set using the SQLH_FILE variable in the JDBC connection string. I'd start by comparing the environment settings for the two users,

    I would also make the following changes for your Connection Manager configuration...

    • Set FOC ORDER=HDR to FOC ORDER=ENABLED in your cmsm.cfg file on your CM servers
    • Set HA_FOC_ORDER to HDR from the default setting in your database server $ONCONFIG file
    ...before restarting your Connection Manager. If you cannot change HA_FOC_ORDER with onmode -w or -m, then you will have to restart your database server as well.








    ------------------------------
    Kirit Rana
    ------------------------------