OpenInformix / IfxPy

Informix native Python driver for scalable enterprise and IoT solutions.
Other
46 stars 22 forks source link

multiple connections with same DBSERVERNAME #17

Closed imamong closed 5 years ago

imamong commented 5 years ago

two informix server has same DBSERVERNAME. how to use?

constr HOST is not working。

ConStr1 = "SERVER=sop_tcp;DATABASE=abc;HOST=10.111.18.18;SERVICE=9088;UID=id;PWD=ps;"

ConStr2 = "SERVER=sop_tcp;DATABASE=abc;HOST=10.111.18.20;SERVICE=9088;UID=id2;PWD=ps2;"

sqlhosts:

sop_tcp onsoctcp        10.111.18.18     9088
sop_tcp onsoctcp        10.111.18.20   9088
jsagrera commented 5 years ago

You can't have two entries with the same name in the sqlhosts file. You will have to include all the connection information in the connection string.

informix@irk:/opt/informix/IBM/OpenInformix/IfxPy/IfxPy/Examples$ grep onsoc s.py
    ConStr = "SERVER=irk1210;DATABASE=stores7;HOST=127.0.0.1;SERVICE=9088;PROTOCOL=onsoctcp;UID=informix;PWD=xxxxx;"
informix@irk:/opt/informix/IBM/OpenInformix/IfxPy/IfxPy/Examples$ 

Add "PROTOCOL=onsoctcp" to your connection string, it should allow you to connect even if there is no trace "sop_tcp" in your sqlhosts file (or there is no sqlhosts at all)

imamong commented 5 years ago

@jsagrera : Thanks.

add 'PROTOCOL=onsoctcp;' to constr.