[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

jdbc with informix 5

Posted on 2008-11-11
7
Medium Priority
?
910 Views
Last Modified: 2013-12-24
hi,

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 {
      Class.forName("com.informix.jdbc.IfxDriver").newInstance();
      conn = DriverManager.getConnection("jdbc:informix-sqli://128.4.2.1:1542/ogcc:INFORMIXSERVER=ONLINE;IFXHOST=develop;USEV5SERVER=1", "informix", "informix");
      this.connected = true;
    }
    catch (Exception e) {
      System.out.println(e);
    }


======================================================================================
0
Comment
Question by:bfanis
  • 4
  • 3
7 Comments
 
LVL 62

Assisted Solution

by:gheist
gheist earned 1000 total points
ID: 22929677
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.
0
 

Author Comment

by:bfanis
ID: 22930456
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
0
 
LVL 62

Expert Comment

by:gheist
ID: 22932455
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.
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:bfanis
ID: 22950631
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  ?  
0
 
LVL 62

Accepted Solution

by:
gheist earned 1000 total points
ID: 22950833
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
http://seifried.org/security/ports/index.php?port_number=1542
0
 

Author Comment

by:bfanis
ID: 23027569
i added the @ ip of the client machine in the /etc/hosts of the informix server , it works .


0
 
LVL 62

Expert Comment

by:gheist
ID: 23032955
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)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

872 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