jdbc with informix 5

Posted on 2008-11-11
Last Modified: 2013-12-24

i am trying to connect to an informix database Version 5.06 with jdbc, the DriverManager.getConnection instruction loops up and returns nothing.
i tried the same connection in a server in my local network and the connection was successful, but when i try to connect to this  server from a distant machine, i get the problem.
telnet from the distant machine to this server works (using informix service port )
what can be the problem ... is there a missing parameter in the connection URL  ?

thx in advance
  try {
      conn = DriverManager.getConnection("jdbc:informix-sqli://;IFXHOST=develop;USEV5SERVER=1", "informix", "informix");
      this.connected = true;
    catch (Exception e) {

Question by:bfanis
    LVL 61

    Assisted Solution

    You have to explicitly enter connection option in onconfig:

    NETTYPE soctcp,1,200,net

    I doubt USEV5SERVER option is of any help.
    Check connection using SquirrelSQL or some other JDBC front.

    Catching overly general exception is not purpose of try/catch construct, not I see any possibility to loop in your code.

    You have to use Type 4 v3 driver only Type 2 versions have serious issues.

    There is demo1 test application that allows you to check connection to Informix databases. They should run in well-configured informix environment with INFORMIXDIR, sqlhosts, correct CLASSPATH etc.

    Author Comment

    hi gheist ,
    USEV5SERVER is mandatory as i read in the ibm jdbc developer guide, when i don't use this option the connection on the server doesn't work.

    jbdc is type 4 driver, isn't it ?

    the problem is that i'm connecting to the same database server,  in the server local network it works, but from a distant machine it doesn't.
    in the sqlhosts file i got this line :
    ONLINE       ontlitcp       develop       s2       (s2 =1542 in etc/services)

    "NETTYPE soctcp,1,200,net"    ?i haven't understood what this command is for
    LVL 61

    Expert Comment

    1) if you use tlitcp protocol, soctcp detects previous releases better

    2) NO. Type 2 JDBC loads native libraries.

    3) Make sure SQLHOSTS on client specify same protocol as sqlhosts file on server.
    Can you ping machine "develop" from client? Does it resolve s2 in drivers\etc\services ???

    4) It is to be put in etc/onconfig on your informix server to supply only required protocol over connection.

    Author Comment

    there is no etc/onconfig on the server
    please explain more 1)

    the problem is that i'm connecting to the same database server  S ,   in the local network  from machine M1 it works, but from a distant machine  M2 it doesn't.

    "telnet S 1542"  works
    "ping S"  works

    it can be a network problem  ?  
    LVL 61

    Accepted Solution

    It could be some sort of network inspection in the middle. Web accelerator or something like that.
    If you have SSH server running on AIX you may try forwarding local port to connect to Informix port and use unaltered connection to confirm network filter is guilty.
    Another way is using tcpdump on AIX and wireshark on windows to see if packets are sent/received cleanly.

    Network inspection may mean antivirus gateway, web accelerator, transparent proxy and God knows what else.
    Does telnet S s2 work ??? i.e service name resolution...

    Port is not used normally, thus it may trigger IDS

    Author Comment

    i added the @ ip of the client machine in the /etc/hosts of the informix server , it works .

    LVL 61

    Expert Comment

    Umm... The real fix is fixing your DNS so that reverse DNS lookups happen on AIX at all (that has to be fixed outside AIX) and that those lookups do happen immediatly - i.e AIX gets caching BIND installation by converting resolv.conf into forwarders in named.boot or named.conf ( pass this to thoes taking care of your DNS server and AIXX system if in doubt)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now