waliwali / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

"communication error" connecting to Informix using ibm_db and Data Server Driver from Linux #116

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
== What steps will reproduce the problem?
1. install the IBM Data Server Driver for ODBC and CLI
2. install ibm_db
3. attempt to make an uncataloged connection as specified here: 
http://code.google.com/p/ibm-db/source/browse/trunk/IBM_DB/ibm_db/tests/test_002
_ConnDbUncatalogedConn.py

== What is the expected output? What do you see instead?

This should create a valid connection object in Python, but instead gives the 
following error message:

Exception: [IBM][CLI Driver] SQL30081N  A communication error has been 
detected. Communication protocol being used: "TCP/IP".  Communication API being 
used: "SOCKETS".  Location where the error was detected: "149.70.120.44".  
Communication function detecting the error: "recv".  Protocol specific error 
code(s): "*", "*", "0".  SQLSTATE=08001 SQLCODE=-30081

== What version of the product are you using? On what operating system?

Informix 11.50.FC6
Data Server Driver: v9.7fp6_linuxx64_dsdriver
ibm_db-1.0.6-py2.6-linux-x86_64.egg
Linux, Ubuntu 10.10 x86_64

Anyone have any idea what I could be doing wrong here? Any idea or tips for 
further debugging would be much appreciated. For ex, is there some additional 
logging I can turn on here?

Thanks very much,
R

Original issue reported on code.google.com by rsolo...@gmail.com on 9 Jul 2012 at 5:19

GoogleCodeExporter commented 9 years ago
I should also add: I am trying to connect FROM the Linux host described above 
(Ubuntu 10.10 x86_64). I am trying to connect TO a remote host running Informix 
11.50.FC6. I don't know what OS that is running but I could verify if that 
would help in the debugging process. My guess was that this shouldn't matter 
too much since I know the Informix version and host, port, username, etc.

thx

Original comment by rsolo...@gmail.com on 9 Jul 2012 at 7:36

GoogleCodeExporter commented 9 years ago
The error you are getting may due to the wrong PORT or there is no entry for 
DRDA protocol nettype in sqlhost file of Informix server 
(eg. dbserverName_drda    drsoctcp        hostname  9091)

Original comment by rahul.pr...@in.ibm.com on 9 Jul 2012 at 8:09

GoogleCodeExporter commented 9 years ago
Hello Rahul,

Thanks for your help.  I have the following line in my sqlhost file on the 
Informix server:
rorytcp         onsoctcp        myserver                istarcars

My database name is "rory" and there are multiple database server instances 
running on this same host, so I've tried specifying the database name as both 
"rory" and "rory@rorytcp". All together, the settings I'm using are:

database: rory@rorytcp
hostname: myserver.domain.com
port: 1002
user: UUU
password: PPP

I have verified this username and password by logging in to the server and 
connecting locally using dbaccess.

I am able to successfully telnet to the server on that port.

Could it be that I need to use ontlitcp instead of onsoctcp? Is there some way 
to determine that?

Any other suggestions?

Are there any logs I could check or additional diagnostic messages I could turn 
on somehow?

thanks very much,
Rory

Original comment by rsolo...@gmail.com on 10 Jul 2012 at 4:28

GoogleCodeExporter commented 9 years ago
oops, one thing: despite what I wrote above, the hostname does in fact match up 
exactly with the hostname in my sqlhost file. So for hostname I am using 
"myserver" ... although I have tried both the short domain name and a fully 
qualified domain name. Neither one works though I am able to connect to both 
directly using telnet. Thanks.

(Sorry, google does not let me edit these messages after posting.)

Original comment by rsolo...@gmail.com on 10 Jul 2012 at 4:38

GoogleCodeExporter commented 9 years ago
Please check which sqlhost file is currently in use through "echo 
$INFORMIXSQLHOSTS" command. and try to add following lines in that 
rorytcp_ids     onsoctcp        myserver  9090
rorytcp_drda    drsoctcp        myserver  9091

and use 9091 port no to connect Informix Database from ibm_db.

Thanks,
Rahul

Original comment by rahul.pr...@in.ibm.com on 10 Jul 2012 at 4:51

GoogleCodeExporter commented 9 years ago
Thanks.

As far as I can tell, the $INFORMIXSQLHOSTS variable is not set and the 
sqlhosts file is in the default location -- ie, $INFORMIXDIR/etc/sqlhosts

I will attempt to try your suggestion. 

One question: if I add those lines to the sqlhost file as you've specified, how 
should I specify my database name when connecting via python? Should it still 
be just "rory" as I tried? Or should it be "rory@rorytcp_ids", or  
"rory@rorytcp_drda", or ...

Also, does the first field in each line of the file need to correspond to the 
name of my Informix server instance? In which case, would I need to create 
Informix servers to match those two lines that you specified? Or maybe this 
does not matter.

Also, do I need both those lines if, as you suggest, I only connect using port 
9091?

Thanks again!

Original comment by rsolo...@gmail.com on 10 Jul 2012 at 5:43

GoogleCodeExporter commented 9 years ago
Another interesting development: if I attempt to connect via Python on ports 
9091 or 9090 (without modifying the sqlhost file at all from what I specified 
above) the ibm_db.connect() function just hangs and does not seem to return at 
all. (I've waited several minutes.)

I will attempt to modify the sqlhost file as you suggest. I'm trying to figure 
out if I need to restart Informix after doing that, or ... ?

thanks.

Original comment by rsolo...@gmail.com on 10 Jul 2012 at 6:47

GoogleCodeExporter commented 9 years ago
"rorytcp_drda" is the name of the database server for which the connectivity 
information is being specified, "desoctcp" is the DRDA nettype and "9091" is 
the port number.
For more information about the sqlhost file please refer
http://publib.boulder.ibm.com/infocenter/idshelp/v115/topic/com.ibm.admin.doc/id
s_admin_0161.htm 

You need to create a database(i.e sample) in rorytcp_drda database server and 
specify "sample" as the database name. 

There is no need of both line because through ibm_db you will only connect to 
Informix server through DRDA protocall.

Original comment by rahul.pr...@in.ibm.com on 10 Jul 2012 at 6:50

GoogleCodeExporter commented 9 years ago
ok thanks I will try that. So when connecting via Python I don't need to 
specify "rorytcp_data" anywhere? ie, Python only seems to allow me to specify 
the database name, the host, the port, username and password. There is no place 
there to specify the database server name. Is that correct?

thanks.

Original comment by rsolo...@gmail.com on 10 Jul 2012 at 7:10

GoogleCodeExporter commented 9 years ago
Correct, connection string for the ibm_db would be like 
"HOSTNAME=myserver.domain.com;PORT=9091;DATABASE=sample;PROTOCOL=TCPIP;UID=UUU;P
WD=PPP;". In this there is no need to specify the database server name.

Original comment by rahul.pr...@in.ibm.com on 10 Jul 2012 at 7:20

GoogleCodeExporter commented 9 years ago
Hi Rahul,

good news: that worked! Thanks very much for your help. It seems that just 
specifying drsoctcp in the sqlhosts file was what did it.

But now another question: We have other applications accessing this database 
server via onsoctcp. Is there a way for one database server to provide access 
via both protocols? Or is there a way to make ibm_db work via onsoctcp?

Thanks very much,
Rory

Original comment by rsolo...@gmail.com on 11 Jul 2012 at 3:29

GoogleCodeExporter commented 9 years ago
No, you can't specify same database server to get access by two different 
protocols.

ibm_db only communicate to informix via DRDA protocol only. 

Thanks,
Rahul Priyadarshi

Original comment by rahul.pr...@in.ibm.com on 12 Jul 2012 at 12:34

GoogleCodeExporter commented 9 years ago
Hi Rahul,

We actually managed to get this to work by using server aliases. We created an 
alias for this server and now have two lines in our sqlhosts file: one with the 
original server name and onsoctcp, and another line with the server alias and 
drsoctcp.

This seems to work great!

Thanks very much again for all your help ~
Rory

Original comment by rsolo...@gmail.com on 12 Jul 2012 at 5:41

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 5 Sep 2012 at 6:57

GoogleCodeExporter commented 9 years ago
Hi folks.  I recognize this thread is a few years old.  We are facing a similar 
situation with a client.  They have a number of Informix servers using onsoctcp 
and we are trying to connect to them using the current Informix/ADO.NET driver 
(the one that ships with DB'2 driver).

Is onsoctcp still considered a supported protocol at this point or should we be 
advising them to move to DRDA?

Original comment by ept...@gmail.com on 24 Apr 2014 at 3:57

GoogleCodeExporter commented 9 years ago
onsoctcp is not supported, they need to move to DRDA only.

Original comment by rahul.pr...@in.ibm.com on 27 Apr 2014 at 4:35