jdbc with informix 5


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) {

Who is Participating?
gheistConnect With a Mentor Commented:
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
gheistConnect With a Mentor Commented:
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.
bfanisAuthor Commented:
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
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

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.
bfanisAuthor Commented:
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  ?  
bfanisAuthor Commented:
i added the @ ip of the client machine in the /etc/hosts of the informix server , it works .

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)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.