waliwali / ibm-db

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

DB name Instance not found #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have an AS/400 with DB named "TESTDB" (for example)
2. Compile ibm_db python module (python 2.6 on debian squeeze using dsdriver)
3. Try to connect database with db2dsdriver.cfg or db2client.ini or with a long 
chain

What is the expected output? What do you see instead?
To have a connection

What version of the product are you using? On what operating system?
Last at this time from pypi repository

Please provide any additional information below.
I installed dsdriver v9.7 then installDriver command
I configure dsn and database in db2dsdriver.cfg
I try connection whith python:
{{{
import ibm_db
conn = ibm_db.connect("alias","username","password")
}}}

And I get this error

{{{
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
Exception: [IBM][CLI Driver] SQL30061N  The database alias or database name 
"TESTDB         " was not found at the remote node.  SQLSTATE=08004 
SQLCODE=-30061
}}}

There is trailling spaces in error... is it normal ? My configuration file has 
no spaces...

I tried with the long string ''DATABASE=..., HOTSTNAME=...'' with the same 
error.

Same error using db2client.ini

The same connection, on same machine with jodbc works.

I use 446 port (50000 is closed).

And I depress... Please help ! 

Original issue reported on code.google.com by Metal3d on 27 Oct 2011 at 3:38

GoogleCodeExporter commented 9 years ago
I did a tcpdump with my java code to check port... I saw that port 449 is used 
for JDBC (with JTOPEN)

Tried to used this port, I get this error:

    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: "192.168.10.33".  Communication function detecting the error: "recv".  Protocol specific error code(s): "*", "*", "0".  SQLSTATE=08001 SQLCODE=-30081

So, I think that connection must be set to another protocol... isn't it ?

Original comment by Metal3d on 28 Oct 2011 at 12:27

GoogleCodeExporter commented 9 years ago
>>>
Exception: [IBM][CLI Driver] SQL30061N  The database alias or database name 
"TESTDB         " was not found at the remote node.
There is trailling spaces in error... is it normal ? My configuration file has 
no spaces...
<<<
This is normal when database didn't found on server then this errors comes.

>>>
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: "192.168.10.33".  
Communication function detecting the error: "recv".  Protocol specific error 
code(s): "*", "*", "0".  SQLSTATE=08001 SQLCODE=-30081

So, I think that connection must be set to another protocol... isn't it ?
<<<
The TCP/IP protocol is right, this exception indicates that client is not able 
to find the database. 

Please check the connection string you have used in the JDBC driver and try to 
create a connection string for the ibm_db python's driver with same credential. 
Use this connection string to create connection connection with ibm_db driver.

If you face any problem in creation of connection string then please let me 
know.
Thanks,
Rahul 

Original comment by rahul.pr...@in.ibm.com on 28 Oct 2011 at 5:15

GoogleCodeExporter commented 9 years ago
I'm using exactly the same string to connect to AS/400 in Java (same user, same 
host, same database name, same password...)

JDBC connection is ok, it uses "as400" protocol, so which one to use with 
python ? Each example I see uses "TCPIP" protocol. 
I used this kind of connection string in Java

    jdbc:as400://192.168.10.33/TESTDB; 

with username and password set to the driverManager

    connection = DriverManager.getConnection("jdbc:as400://192.168.10.33/TESTDB","USER","PASS");

As I said, I  checked connections with tcpdump, I saw that Java connected to 
449 port then switch to others ports. It seems that 449 is a port mapper.

My connection string is in this form:
DATABASE=TESTDB;HOSTNAME=192.168.10.33;PORT=446; 
PROTOCOL=TCPIP;UID=username;PWD=password;

I changed username and password to the right values, "TESTDB" is changed here 
for the example, the right name was set on my connection. I tried PORT=50000 
(no connection), 449 (error recv), 446 (database not found)... 

What I don't undestand, in documentation, is: DRIVER={IBM DB2 ODBC DRIVER};

I installed dssdriver 9.7 (and tried with 9.5). This is not an ODBC connection. 
I cannot install db2 express on this server

Thanks for you help :)

Original comment by Metal3d on 30 Oct 2011 at 1:58

GoogleCodeExporter commented 9 years ago
I forget to tell you that I tried without "PORT". And don't be surprise by the 
space I badly instert in my last message inside the connection string. There is 
no space in my connection strings...

This is my tested connections:

DATABASE=TESTDB;HOSTNAME=192.168.10.33;PORT=446;PROTOCOL=TCPIP;UID=username;PWD=
password;
DATABASE=TESTDB;HOSTNAME=192.168.10.33;PORT=449;PROTOCOL=TCPIP;UID=username;PWD=
password;
DATABASE=TESTDB;HOSTNAME=192.168.10.33;PROTOCOL=TCPIP;UID=username;PWD=password;

With username and password to right values.

Regards,

Patrice - FRANCE

Original comment by Metal3d on 2 Nov 2011 at 1:39

GoogleCodeExporter commented 9 years ago
It looks like you are on the AS/400 machine, But currently we only supports 
remote connection to this machine.

You can download iseries natively supported ibm_db from 
http://code.google.com/p/ibm-db/issues/detail?id=71&can=1&q=iseries. and in 
case of any problem please post your issues on 
http://www.iseriespython.com/app/ispMain.py/Start?job=Posts.

Thanks,
Rahul

Original comment by rahul.pr...@in.ibm.com on 14 Nov 2011 at 9:28

GoogleCodeExporter commented 9 years ago
Iserie is made to work on an AS/400. I'm on Ubuntu and Fedora and I only want 
to connect an AS/400 to send SQL "from linux" "to AS/400". So no, I'm not on 
AS/400, I'm on Linux...

Compilation, Python side etc... are made on Linux

Original comment by Metal3d on 14 Nov 2011 at 8:24

GoogleCodeExporter commented 9 years ago
DSDriver only is not sufficient to connect AS/400 from ibm_db, you needs to 
have DB2 connect product installed on your client machine.

Original comment by rahul.pr...@in.ibm.com on 16 Nov 2011 at 11:22

GoogleCodeExporter commented 9 years ago
DB2 is not installable without X, I tried to install it with deported display, 
nothing works.

I don't understand why Java only needs a simple (and lightweight) jar to 
connect, and Python needs DB2 utilities... Note that imb_db module compiled 
with dsdriver.

There is no way to connect AS/400 DB with python without installing many 
products ? 

So, without X, I have no chance to connect AS/400 from my Debian server... 
right ?

Original comment by Metal3d on 16 Nov 2011 at 1:55

GoogleCodeExporter commented 9 years ago
You can able to connect through DS Driver also if you have DB2 connect license( 
please contact i5 sysadmins, for if they have some licenses available already).

Put your DB2 license file inside ../clidriver/license/ folder after that modify 
you db2dsdriver.cfg file like follows
=======
<configuration>
   <dsncollection>
      <dsn alias="TESTDB" name="TESTDB" host="192.168.10.33" port="446"/>
   </dsncollection>
   <databases>
      <database name="TESTDB" host="192.168.10.33" port="446">
           <parameter name="CommProtocol" value="TCPIP"/>
      </database>
   </databases>
</configuration>
===============

After this, try to connect OS/400 with ibm_db.connect('TESTDB', 'uname', 
'password')

PS: don't forgot to set LD_LIBRARY_PATH with DSDriver's lib folder ex- export 
LD_LIBARARY_PATH=/path/to/ds/driver/clidriver/lib:$LD_LIBARARY_PATH

Please let me know in case of any issue.

Original comment by rahul.pr...@in.ibm.com on 17 Nov 2011 at 6:57

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 16 Apr 2012 at 8:50