Getting error as 'Segmentation fault (core dumped)' for IBM i series

787 views
Skip to first unread message

sidd...@erpdata.cloud

unread,
Jun 7, 2018, 10:10:38 AM6/7/18
to ibm_db
Hi,

I am using ibm_db_sa and as400 drivers to connect db2 for i. When I am going to fetch data from the table which is not exists in db, then without giving proper message application throws following error (Expected error is : Table does not exists or something related to that)
Segmentation fault (core dumped)

My code snippet is below:

def connect_db2():
try:
e = create_engine("ibm_db_sa+pyodbc400://u000****:XXX...@172.29.XXX.XX/T10050sp",
pool_size=20, echo=False, poolclass=QueuePool).connect()
except Exception as ex:
raise ex
return e


def conn_test():
try:
conn = connect_db2()
if conn:
data =conn.execute('select * from sourcedb.customers1')
for row in data:
print(row)
except Exception as ex:
print(ex.__str__())



Abhinav Radke

unread,
Jun 8, 2018, 7:56:26 AM6/8/18
to ibm_db
Hi,
This is Abhinav, we are looking into this issue, Will update once we fixed this.

Thanks,
Abhinav

sidd...@erpdata.cloud

unread,
Jun 8, 2018, 10:37:35 AM6/8/18
to ibm_db
Hi Abhinav, Thanks. I will wait for your reply. Thanks

Siddhesh Naik

unread,
Jun 8, 2018, 10:38:28 AM6/8/18
to ibm...@googlegroups.com
Can you please let me know what would be the estimated time for this feature release as I might be using this library in my current project. Thanks


--
You received this message because you are subscribed to the Google Groups "ibm_db" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ibm_db+unsubscribe@googlegroups.com.
To post to this group, send email to ibm...@googlegroups.com.
Visit this group at https://groups.google.com/group/ibm_db.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
 
Siddhesh Naik |  M : +91  9867028792   

Email : sidd...@erpdata.cloud  |  Website : www.essentio.com

cid:E968B825-BA1C-4FC8-A296-7D688506BD60
We manage your data while you manage your business

hemlata bhatt

unread,
Jun 13, 2018, 1:26:55 AM6/13/18
to ibm_db
Hi Siddhesh,

Can you please share your pip list .

Regards
Hemlata

On Friday, June 8, 2018 at 8:08:28 PM UTC+5:30, Siddhesh Naik wrote:
Can you please let me know what would be the estimated time for this feature release as I might be using this library in my current project. Thanks
On Fri, Jun 8, 2018 at 11:50 AM, Abhinav Radke <abhi...@gmail.com> wrote:
Hi,
This is Abhinav, we are looking into this issue, Will update once we fixed this.

Thanks,
Abhinav

--
You received this message because you are subscribed to the Google Groups "ibm_db" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ibm_db+un...@googlegroups.com.

To post to this group, send email to ibm...@googlegroups.com.
Visit this group at https://groups.google.com/group/ibm_db.
For more options, visit https://groups.google.com/d/optout.

sidd...@erpdata.cloud

unread,
Jun 13, 2018, 3:42:41 PM6/13/18
to ibm_db
Hi Hemlata,

Kindly find my pip list below

amqp==2.2.2
billiard==3.5.0.3
BTrees==4.4.1
celery==4.1.0
cx-Oracle==6.1
ibm-db==2.0.8a0
ibm-db-sa==0.3.3
kombu==4.1.0
persistent==4.2.4.2
psycopg2==2.7.4
pymongo==3.6.1
pyodbc==4.0.22
pytz==2018.3
redis==2.10.6
six==1.11.0
SQLAlchemy==1.2.2
transaction==2.1.2
vine==1.1.4
zc.lockfile==1.2.1
ZConfig==3.2.0
ZODB==5.3.0
zodbpickle==1.0
zope.interface==4.4.3
zope.sqlalchemy==1.0

sidd...@erpdata.cloud

unread,
Jun 13, 2018, 3:42:41 PM6/13/18
to ibm_db
Hi Hemlata,

Please find my pip list

Abhinav Radke

unread,
Jun 19, 2018, 11:18:57 PM6/19/18
to ibm_db
Hi ,
I tried to repro this issue but I am not hitting the crash, getting below expected error statement.
Can you please check and let us know if you missed to add any information in description.

while testing I faced some compilation issue, did you also faced any issue?

(pyodbc.ProgrammingError) ('42S02', '[42S02] [IBM][CLI Driver][AS] SQL0204N  "D700060X.CUSTOMERS1" is an undefined name.  SQLSTATE=42704\r\n (-204) (SQLExecDirectW)') [SQL: 'select * from D700060x.customers1']

sidd...@erpdata.cloud

unread,
Jun 20, 2018, 4:24:27 AM6/20/18
to ibm_db
Hi Abhinav,

I am getting same error again.
Additional information is like I am using user defined schema instead of default schema.
Also my pip list is below:
amqp==2.2.2
billiard==3.5.0.3
BTrees==4.4.1
celery==4.1.0
cx-Oracle==6.1
ibm-db==2.0.8a0
ibm-db-sa==0.3.3
kombu==4.1.0
persistent==4.2.4.2
psycopg2==2.7.4
pymongo==3.6.1
pyodbc==4.0.22
pytz==2018.3
redis==2.10.6
six==1.11.0
SQLAlchemy==1.2.2
transaction==2.1.2
vine==1.1.4
zc.lockfile==1.2.1
ZConfig==3.2.0
ZODB==5.3.0
zodbpickle==1.0
zope.interface==4.4.3
zope.sqlalchemy==1.0

kindly check with user defined schema. 

Abhinav Radke

unread,
Jun 20, 2018, 7:52:38 AM6/20/18
to ibm_db
Hi,
Here we are not explicitly setting the schema and it doesn't looks like user defined schema is creating a problem.
can you please re run the case and share the dump stack so that we can have a better look on it.
Can you confirm did you faced any issue while compilation because AS400 have some issues and ideally it should have thrown you the error in pyodbc.py file


Thanks,
Abhinav

sidd...@erpdata.cloud

unread,
Jun 20, 2018, 8:13:54 AM6/20/18
to ibm_db
Ok.Thanks
I will share the dump stack soon.My db2-i reservation get expired.

By that time I faced few compilation issues with pyodbc.py file.That are mentioned below
1) name unicode not defined
2) iteritems key errors
3) AS400Reflector object has no attribute get_unique_constraints 
4)db_name attribute not found

so I made few changes in library that resolved above issues. Can you please share ibm_db_sa and ibm_db library that you are using ?My libraries are 
ibm-db==2.0.8a0
ibm-db-sa==0.3.3

Abhinav Radke

unread,
Jun 26, 2018, 5:34:16 AM6/26/18
to ibm_db
Hi,
I am using below libraries. I am not able to reproduce the crash.

ibm-db (2.0.8)
ibm-db-sa (0.3.3)

Thanks,
Abhinav

sidd...@erpdata.cloud

unread,
Jun 26, 2018, 7:13:31 AM6/26/18
to ibm_db
Hi Abhinav,

I am still facing same issue. Below I have mentioned the driver details. 

[iSeries Access ODBC Driver 64-bit]
Description = iSeries Access for Linux 64-bit ODBC Driver
Driver = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading = 2
DontDLClose = 1


Also I am using driver iSeriesAccess-6.1.0-1.0.x86_64 .  My server OS is IBMi7.3 . I think that is main issue. driver version and OS version not matching. Please suggest your opinion. Also I am not able to download any  iSeriesAccess-7.*-1.0.x86_64 driver version. Please help.

Saba Kauser

unread,
Jun 26, 2018, 7:18:27 AM6/26/18
to ibm_db
ibm_db is designed to use with Db2 ODBC and CLI driver.
If you intend to use iSeries driver, then you would need to use this:

HTH.

sidd...@erpdata.cloud

unread,
Jun 26, 2018, 8:38:45 AM6/26/18
to ibm_db
Hi Saba

I dint get your point "ibm_db is designed to use with Db2 ODBC and CLI driver. " . Could you please elaborate.

Also I have downloaded the "IBM i Access Client Solutions" package but its doe not contain any drivers related package. 

Saba Kauser

unread,
Jun 26, 2018, 8:41:55 AM6/26/18
to ibm_db
Hello Siddhesh,

You would need to use libdb2.so library that comes with db2 LUW clidriver.
ibm_db driver automatically installs clidriver as we use CLI APIs under the cover. or user can set IBM_DB_HOME to install location of DB2 ODBC Driver.
Can you elaborate on how you are using iSeries driver? I would expect that ibm_db driver load libdb2.so for its API calls, not iSeries driver.


On Tuesday, June 26, 2018 at 4:48:27 PM UTC+5:30, Saba Kauser wrote:

sidd...@erpdata.cloud

unread,
Jun 26, 2018, 10:50:52 AM6/26/18
to ibm_db
Hi Saba

I am using both the database in my project. For DB2 LUW I am not facing any issue.Its work like charm.

For DB2i series database I am using iseries drivers. I dont have that much knowledge of DB2i series database. Do you mean to say, I can access Db2i series database by using Db2 LUW drivers ?

Saba Kauser

unread,
Jun 26, 2018, 10:51:29 AM6/26/18
to ibm_db
Yes, you can connect to iSeries DB using DB2 LUW drivers.

sidd...@erpdata.cloud

unread,
Jun 27, 2018, 8:57:11 AM6/27/18
to ibm_db
Hi Saba,

Thanks.

I have downloaded the cliedriver package (linux x64). But I don't have any idea how to configure it on Ubuntu machine. I have checked IBM website site,but that instruction is not proper I guess.(db2cli install-setup command not working).Could please help me to set up this clidriver? Please???

Also I am using pyodbc.py file for db2 iseries. But it has lots of bugs. Could you please suggest any alternative library for the same ?

Saba Kauser

unread,
Jun 27, 2018, 9:01:07 AM6/27/18
to ibm_db
You do not have to install the package separately. Just install python ibm_db driver on linux x64 and it would be installed automatically by driver.

pip install ibm_db==2.0.8a

You can the connect to remote db on iSeries using below connection string:
connection_string='database=<dbname>;hostname=<hostname>;port=<drda port>;protocol=tcpip;uid=<uid>;pwd=<pwd>;'

HTH.

sidd...@erpdata.cloud

unread,
Jun 27, 2018, 11:11:32 PM6/27/18
to ibm_db
Hi Saba
Thanks

I tried the suggestions you have given. I got following 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: "172.29.153.59".  Communication function detecting the error: "connect".  Protocol specific error code(s): "111", "*", "*".  SQLSTATE=08001 SQLCODE=-30081

My code snippet is

import ibm_db
import ibm_db_dbi
def connect_db2_iseries():
    connection_string = 'database=T10050bp;hostname=172.29.153.59;port=50000;protocol=tcpip;uid=xxxxxxx;pwd=******;'
    ibm_db_conn = ibm_db.connect(connection_string, '', '')
    conn
= ibm_db_dbi.Connection(ibm_db_conn)
    conn.tables('SYSCAT', '%')

What I did wrong ?

Saba Kauser

unread,
Jun 27, 2018, 11:18:39 PM6/27/18
to ibm_db
Hi Siddhesh,

DRDA is usually configured for DRDA on port 446 on IBM i.. However, you can check which port of your machine is configured for TCP/IP connections from remote clients.
I am not iSeries expert, but there are articles and infocenter pages that might help you.

the error 30081 would mean server is not listening for requests at port 50000.

sidd...@erpdata.cloud

unread,
Jun 28, 2018, 2:34:49 AM6/28/18
to ibm_db
Hi Saba,
Thanks

Now I tried with port 446.But got new error

(ibm_db_dbi.ProgrammingError) ibm_db_dbi::ProgrammingError: [IBM][CLI Driver] SQL1598N  An attempt to connect to the database server failed because of a licensing problem.  SQLSTATE=42968 SQLCODE=-1598 (Background on this error at: http://sqlalche.me/e/f405)

I have Db2i reservation also have VPN connection. I guess that much enough to connect to database. Is there any licensing required ?

Saba Kauser

unread,
Jun 28, 2018, 2:39:29 AM6/28/18
to ibm_db
you would either need client side or server side license for connecting to iseries.
server side license can be activated using db2connectactivate utility and client side license db2consv_is.lic can be obtained from IBM.
Client side license if you have one already, can be copied under clidriver/license folder and reconnect.

sidd...@erpdata.cloud

unread,
Jul 2, 2018, 4:46:37 AM7/2/18
to ibm_db
Hi Saba,
Thanks.
I dont have license files. We are using i-series driver to connect the database.For that we are using ibm_db+as400 dialect (this dialect not required license file).On java,we are able to connect database without license key. We are now migrating from java to python. Could you please tell who is maintaining pyodbc.py file under ibm_db. That file raising segmentation fault error. Also is there any other way to connect database without license file ?

Saba Kauser

unread,
Jul 2, 2018, 4:52:36 AM7/2/18
to ibm_db
you can install our python ibm_db driver on linux/unix/windows/mac and connect to iSeries remotely from these clients. To connect to iSeries, you would need license and there is no way out to connect without license. We have documented it here ->https://github.com/ibmdb/python-ibmdb/blob/master/IBM_DB/ibm_db/README.md#license-requirements-for-connecting-to-databases
pyodbc is not owned by us, neither it is packaged by us. Looks like you are using pyodbc driver-> https://pypi.org/project/pyodbc/

You can reach out to Kevin Adler, owner of ibm_db driver for iSeries -> https://github.com/ibmdb/python-ibmdb/tree/ibmi/IBM_DB/ibm_db

Thanks!

sidd...@erpdata.cloud

unread,
Jul 2, 2018, 7:51:08 AM7/2/18
to ibm_db
Thanks Saba,

When I am installing ibm_db_sa that time pyodbc.py get placed under site-packages/ibm_db_sa folder. Do you mean to say ibm_db_sa is different than ibm_db? If it is different then who is maintaining that library, please help me to reach to them.

Also how could I reach to Kevin Adler ?Please help

Saba Kauser

unread,
Jul 2, 2018, 7:55:31 AM7/2/18
to ibm_db
Hello Siddhesh,
ibm_db_sa is SQLAlchemy adapter. Although it has dependency on ibm_db, but ibm_db_sa different than ibm_db. Abhinav or Hema should be able to assist you with ibm_db_sa.
You can reach out to Kevin adler via git. He owns this branch -> https://github.com/ibmdb/python-ibmdb/tree/ibmi/IBM_DB/ibm_db.
He is also an IBMer I believe.  kad...@us.ibm.com

sidd...@erpdata.cloud

unread,
Jul 2, 2018, 11:05:27 AM7/2/18
to ibm_db
Hi Saba,
Thanks. 
What if I host my application on IBM i series server ? Still do I need license file ? 

Saba Kauser

unread,
Jul 2, 2018, 11:14:05 AM7/2/18
to ibm_db
ibm_db or ibm_db_sa is not validated or designed to be installed on iSeries. You can install ibm_db on LUW and Mac and establish remote connection to iSeries.
I suggest that you get in touch with Kevin as he works more closely to iSeries connectivity from ibm_db.

Thanks!

kad...@us.ibm.com

unread,
Jul 2, 2018, 11:42:45 AM7/2/18
to ibm_db
If you use ibm_db on IBM i, you do not need a license file as we use the IBM i CLI interface instead of the DB2 Connect/LUW CLI. You can find more information on how to get things set up here: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/Open%20Source%20RPM%27s

Once you get yum installed, you can install ibm_db with `yum install python3 python3-ibm_db`

Note that my team has not evaluated that ibm_db_sa works with IBM i yet.


Additionally, it seems you are using the iSeriesAccess ODBC driver version 6.1. This is over a decade old and has known issues with modern ODBC driver managers on 64-bit platforms. You really should get the latest ODBC driver here: http://www-01.ibm.com/support/docview.wss?uid=isg3T1026805

sidd...@erpdata.cloud

unread,
Jul 4, 2018, 4:12:10 AM7/4/18
to ibm_db
Hi Kevin,

Thanks. I was trying to install my application on i series server but some of the other packages from my application not get installed properly.
What if I install https://github.com/ibmdb/python-ibmdb/tree/ibmi/IBM_DB/ibm_db this branch on my linux machine ? Still I required license file ? I tried to use this library but its gives syntax error for connection.

I am using iSeriesAccess ODBC driver 6.1. I am not able to find new version of ODBC driver for iSeriesAccess. The link which you provided ( http://www-01.ibm.com/support/docview.wss?uid=isg3T1026805 ) is for IBM i Access -  Client solution. This package doesn't contain any driver details. package folder details are attached.
ibmiAccessSolutionMainFolder.png - shows all available content under the parent package
ibmaccesssolution_LinuxApplicationFolder.png - Shows all the content  under the LinuxApplication folder.

In the Optional platform-specific packages section in provided link mentioned that  Connectivity to DB2® for i using ODBC feature will get on other package.Link for the package download is http://www-304.ibm.com/servers/eserver/ess/index.wss . On this I didint get any download link after the login. 

Could you please ? My first priority is (project requirements) access IBM i series database using ODBC drivers and use ibm_db_sa +pyodbc library for this. Could you please help me to resolve this issues ?
ibmaccesssolution_LinuxApplicationFolder.png
ibmiAccessSolutionMainFolder.png

sidd...@erpdata.cloud

unread,
Jul 4, 2018, 7:18:23 AM7/4/18
to ibm_db
Hi,

I am able to resolved this issue. Finally I got link to download the latest odbc driver for linux. After installation of new driver , segmentation fault error get removed. Now I am able to capture proper error messages using ibm_db_sa + pyodbc.

Thanks Abhinav,Saba and Kevin for your valuable support & patience. 

Saba Kauser

unread,
Jul 4, 2018, 8:59:24 AM7/4/18
to ibm_db
Hi Siddhesh,
could you share the link so that others who might run into similar problem can get to solution quicker.
You also mentioned that you were trying to install your application(and hence the driver) on iSeries server, can you also clarify if your intention is to use driver on Linux and connect to iSeries or Are you talking about Linux on iSeries?

If some one is looking at this thread, they might not get clear understanding of the problem and resolution, hence if you can provide a short summary of the actual problem, and how it got resolved would be helpful to others.

Thanks,
Saba.

sidd...@erpdata.cloud

unread,
Jul 8, 2018, 11:12:04 PM7/8/18
to ibm_db
Hi Saba,

I was trying to run my python application on iseries server to just for license requirement testing . My primary intention is use iseries driver on Linux and connect to iSeries database and now I able to connect iseries database from linux using iseries driver.

Below I am writing , what is the use-case,problem I faced, its reason and how you can resolve this.

use-case: I want to connect to IBM i series database using ibm_db_sa +pyodbc dialect.I dont want to use ODBC driver,iseries drivers instead of ibm cli drivers. My expectation was when I am going to access data from table which is not exists on database, driver should return table not exists kind of error(error message based on database driver). 

Problem: Whenever I am trying to access data from not existence table ,my application execution get aborted with error Segmentation fault (core dumped).   

Reason: The reason was a old version of ibm iseries drivers. I was using iseries drivers 6.1 which are outdated.

Solution: Install latest ibm iseries drivers. To install latest ibm iseries drivers you have to follow the below steps. (There may be other easy way available to download the iseries driver,I am just sharing my experience)

1) Visit http://www-01.ibm.com/support/docview.wss?uid=isg3T1026805 url and go into Optional platform-specific packages section and click on Entitled Systems Support (ESS). Refer screen1.png from the attachment files)

2)On newly opened page you need to sign in with your registered IBM id (Refer screen2.png from the attachment files)

3)After login,you will get redirected to My Entitled Systems Support page.Click on My entitled software menu from left menu bar.(Refer screen3.png from the attachment files)

4)Then click on IBM i evaluation and NLV download (Refer screen 4.png from the attachment files)

5)Then select 5770SS1 package and continue (Refer screen 5.png from the attachment files)

6)Then select IBM i Access Client solutions -Linux AP package & continue (Refer screen 6.png from the attachment files)

after that just follow the simple sets of instructions provided on web portal & you will get able to download i series drivers.

If you are linux user, extract the downloaded zip file and install .deb package under x86_64 folder.Refer installation.png from the attached files.

After installation you will get i series drivers configuration in odbcinst.ini file. Refer odbcinstfile.png from the attached files.

Hope that help.
installation.png
odbcinstfile.png
screen1.png
screen2.png
screen3.png
screen4.png
screen5.png
screen6.png

Saba Kauser

unread,
Jul 10, 2018, 1:32:44 AM7/10/18
to ibm_db
Thanks Siddhesh!
Reply all
Reply to author
Forward
0 new messages