Can someone help me to connect Informix IDS with Spring Boot?
Posted in 2022
Gustavo Echenique could not connect Spring Boot via JDBC to IDS 7.31 and got connection refused. Art Kagel noted 7.31 predates DRDA support and the native protocol changed at 9.20. Paul Watson and Art found the engine listened only on the loopback address and sqlhosts needed fixing. After changes, ilogin worked but the SQL editor stopped connecting. Unresolved.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Topics: Connectivity: ODBC / JDBC / .NET, Java & JDBC Development, Versions, Editions & End-of-Life
Dear colleagues: I am trying to connect an Informix IDS 7.31 TD9 engine in a project created with Spring Boot via JDBC, but I am not getting my goal. I first tried Maven's Informix dependencies, but they all give me the same error: "Connection refused". I note that when you create a Spring Boot project, many databases appear, but not Informix. I checked the Hibernate documentation, which is Spring Boot's default persistence layer, and Informix does support it based on what they show. Then I tried the IBM DB2 JCC Driver, which according to its documentation is used to connect both DB2 and Informix, following its examples, but it gives me an error, it says that the database cannot be opened. The message that appears is the following: "Exception java.net.ConnectException: Error opening server socket localhost/127.0.0.1 on port 1.526 with message: Connection refused: no further information. ERRORCODE=-4499, SQLSTATE= 08001". Does anyone know the way to solve this? Thank you in advance for your attention. Greetings. Gustavo Echenique ------------------------------ Gustavo Echenique ------------------------------ #Informix
Gustavo: The problem with using the DV2 connector is that you are trying to connect to IDS v7.31 which proceeds the acquisition of Informix by IBM so it does not support the DRDA protocol DB2 uses. Similarly while Hibernate does have a native Informix connector, recent releases may no longer support the older protocol that IDS 7.31 used. Informix's native protocol changed with v9.20 to support new data types. Can you upgrade to the current Informix release? Version 14.10 ------------------------------ Art S. Kagel, President and Principal Consultant ASK Database Management Corp. www.askdbmgt.com ------------------------------
Can you telnet 127.0.0.1 1526 If that gives a connection refused you have a firewall issue or you are on binding to the port you will think you are Cheers Paul Paul Watson Oninit LLC +1-913-387-7529 www.oninit.com Oninit® is a registered trademark of Oninit LLC
We are downloading Informix JDBC driver with maven but not with spring boot, and with newer IDS version, so this process works, at least. Hibernate is relying on whatever JDBC driver you are supplying, it does not have its own connector. It does take some configuration, though. "Connection refused" normally means that no-one is listening on the port you are connecting to. But it can also be local firewall issues. The telnet test mentioned by others is good to verify that you can actually connect. Maybe you can do a netstat -na | grep 1526 to verify that your Informix instance is listening on this port? ------------------------------ Øyvind Gjerstad Developer/Architect PostNord AS ------------------------------
Dear Paul, thank you very much for your answer. I have tried to connect with telnet to the address 127.0.0.1 1526 and it has refused the connection. Then I tried " telnet localhost 1526 " and the connection was also rejected (obviously if it had been rejected with the IP, this was expected). Only when I entered the PC name " telnet desarrollo 1526 " was it able to connect. However, I have created inbound and outbound firewall rules for this port, but when I try to telnet (with the first two options) it keeps refusing the connection. If I add the name of the PC ( desarrollo ) to the Spring project instead of localhost in aplication.properties , it doesn't start Hikari, it hangs, the same if I add the IP address of the machine. I'm very confused. ------------------------------ Gustavo Echenique ------------------------------
What does desarrollo resolve to ? Remember localhost != desarrollo If everything is on the same PC and with everything running look at netstat –an to see what ports are bound to the ip and 127.0.0.1 What is in INFORMIXSQLHOSTS and/or setnet32
I'm guessing that your sqlhosts file has the name of the machine in the IP field and not 127.0.0.1 (localhost). That is why you can connect using the machine name which maps to its actual IP address and not to localhost. ------------------------------ Art S. Kagel, President and Principal Consultant ASK Database Management Corp. www.askdbmgt.com ------------------------------
Hi Paul! I pass you the result of the netstat -a command. The name of the IDS service is the one that comes by default (turbo). In the listing, I see that the Development PC connects to other ports. In Setnet32 the hostname is declared as Development. TCP 127.0.0.1:1526 Desarrollo:0 LISTENING TCP 127.0.0.1:1526 Desarrollo:53497 ESTABLISHED TCP 127.0.0.1:1526 Desarrollo:53523 ESTABLISHED TCP 127.0.0.1:1526 Desarrollo:53524 ESTABLISHED TCP 127.0.0.1:5278 Desarrollo:0 LISTENING TCP 127.0.0.1:5279 Desarrollo:0 LISTENING TCP 127.0.0.1:5280 Desarrollo:0 LISTENING TCP 127.0.0.1:6341 Desarrollo:0 LISTENING TCP 127.0.0.1:6342 Desarrollo:0 LISTENING TCP 127.0.0.1:21327 Desarrollo:0 LISTENING TCP 127.0.0.1:49802 Desarrollo:49803 ESTABLISHED TCP 127.0.0.1:49803 Desarrollo:49802 ESTABLISHED TCP 127.0.0.1:53493 Desarrollo:54926 ESTABLISHED TCP 127.0.0.1:53497 Desarrollo:turbo ESTABLISHED TCP 127.0.0.1:53523 Desarrollo:turbo ESTABLISHED TCP 127.0.0.1:53524 Desarrollo:turbo ESTABLISHED ------------------------------ Gustavo Echenique ------------------------------
So you are only listening on localhost so IP connection will fail. Edit sqlhosts or use setnet32 to use the ip instead Cheers Paul Paul Watson Oninit LLC +1-913-387-7529 www.oninit.com Oninit® is a registered trademark of Oninit LLC
Hi Paul! I seem to have resolved the port directionality issue, since running the command netstat -a | findstr "1526", I get the following output: TCP 192.168.100.12:1526 Development:0 LISTENING What catches my attention is that I run Setnet32 as a normal user, the following data appears: But if I run it as administrator, the data is as follows, and it should be correct: When running the Spring project I am getting the following errors: Caused by: com.informix.asf.IfxASFException: Attempt to connect to database server (ol_gechenique) failed. at com.informix.util.IfxErrMsg.getLocIfxASFException(IfxErrMsg.java:751) ~[jdbc-4.10.6.20151104.jar:4.1.0.SNAPSHOT] at com.informix.asf.Connection.openSocket(Connection.java:1821) ~[jdbc-4.10.6.20151104.jar:4.1.0.SNAPSHOT] at com.informix.asf.Connection.<init>(Connection.java:395) ~[jdbc-4.10.6.20151104.jar:4.1.0.SNAPSHOT] at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1404) ~[jdbc-4.10.6.20151104.jar:4.1.0.SNAPSHOT] ... 56 common frames omitted Caused by: java.lang.IllegalArgumentException: hostname can't be null at java.base/java.net.InetSocketAddress.checkHost(InetSocketAddress.java:159) ~[na:na] at java.base/java.net.InetSocketAddress.<init>(InetSocketAddress.java:226) ~[na:na] at com.informix.asf.Connection.getSocket(Connection.java:2160) ~[jdbc-4.10.6.20151104.jar:4.1.0.SNAPSHOT] at com.informix.asf.Connection.openSocket(Connection.java:1783) ~[jdbc-4.10.6.20151104.jar:4.1.0.SNAPSHOT] ... 58 common frames omitted I have already checked the Windows registry (10) and in the Sqlhosts key, the data is correct, as in the second screen that I copied. ------------------------------ Gustavo Echenique ------------------------------
That looks like -908 error, normally a mismatch between ip, port and/or INFORMIXSERVER. Easy to test using dbping or ilogin Cheers Paul Paul Watson Oninit LLC +1-913-387-7529 www.oninit.com Oninit® is a registered trademark of Oninit LLC
Paul, the iLogin Demo connects and shows me the records of the Stores7 database, but now the SQL Editor does not connect to me, which it did until today. I don't know what to think or what to modify, I'm very confused. Never in my 21 years of working with Informix has anything like this happened to me. ------------------------------ Gustavo Echenique ------------------------------