Link to home
Start Free TrialLog in
Avatar of KzKrew
KzKrewFlag for United States of America

asked on

Linux ODBC Connection using IBM AS400 Client Solutions on Raspberry pI

QuickStartGuide.html
I currently have an application that uploads production data from a Raspberry Pi to a MySQL database using the following connection
cnx = mysql.connector.connect(host="10.1.x.x",user="usr1", passwd="password", database="database")
Looking to covert this process and upload to a IBM AS400 table.
I have loaded IBM Client Solutions on the Raspberry PI and able to connect to tables via the gui interface.
Question: How do I create a connector using the ODBC drivers supplied with Client Solutions?
Or is there other drivers or library’s that I should be using 
Let me know 
Attached in the quick start guide – Client Solutions 
Thanks – Dan
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

IBM offers a data connector package for ACS for Linux that's definitely worth a try.  There are also some connectivity options that don't require database drivers on the client side, especially XMLService - which provides an XML based interface to IBM i DB2, plus commands, program calls, service program calls, system APIs, and PASE:

http://yips.idevcloud.com/wiki/index.php/Xmlservice/Xmlservice

What programming language?  There are toolkits that interface to XMLService for Node.js, php, Ruby, .NET, and Python, for example:

https://github.com/IBM/nodejs-itoolkit


Avatar of KzKrew

ASKER

Will be using Python. Have No experience with XML. Maybe i need to dig on that.
That said  -- Was hopping that i could just configure a ODBC DSN on the Raspberry Pi based on  IBM ACS
So easy in Windows. I have installed IBM Client Solutions on the Raspberry pi -- able to connect to DB2 tables on the AS400 via ACS Gui.
How do i create a Linux ODBC DSN on the Raspberry PI?
Or do i need to use other methodology
Look at the python toolkit for xmlservice database examples.  It is very simple.  The toolkit composes the xml for.you.  you just call the toolkit functions.
Look at the Python toolkit for xmlservice.  you don't need to know xml.  the toolkits compose it for you.  you just make function calls.  Very easy to use, without all the Java overhead.
Avatar of KzKrew

ASKER

Ok -- have Python toolkit installed. Following the Readme.md from https://github.com/IBM/python-itoolkit
Trying to run the sample - code  from that page - see below:
from itoolkit import *
from itoolkit.transport import DatabaseTransport
import ibm_db_dbi
conn = ibm_db_dbi.connect()
itransport = DatabaseTransport(conn)
itool = iToolKit()
itool.add(iCmd5250('wrkactjob', 'WRKACTJOB'))
itool.call(itransport)
wrkactjob = itool.dict_out('wrkactjob')
print(wrkactjob)

Open in new window

Get error: No module names 'ibm_db_dbi'
Try to install using sudo pip install ibm_db
Get the following error:
s
pi@raspberrypi:~ $ sudo pip install ibm_db
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting ibm_db
  Using cached https://files.pythonhosted.org/packages/6f/4e/48bf113d4f14b20a5008ea9f7784654041d8f7730c1081b370f569d80c93/ibm_db-3.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Detected 32-bit Python
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-gDpkFf/ibm-db/setup.py", line 197, in <module>
        easy_cli_path = os.path.join(tmp_path, 'ibm_db-%s.egg' % ("-".join([VERSION, "py"+sys.version.split(" ")[0][0:3]]) if('win32' in sys.platform) else "-".join([VERSION, "py"+sys.version.split(" ")[0][0:3], os_, arch_])), 'clidriver')
    NameError: name 'arch_' is not defined
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-gDpkFf/ibm-db/

I am running 32 bit Linux
Any thoughts
Dan
ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KzKrew

ASKER

Ok -- it looks like there is no easy solution. IBM offers a data connector package for ACS but only the 64 bit version includes db2 odbc connectivity. Raspberry Pi is 32 Bit
Current Raspberry PI OS does not include support for itoolkit. Would need to compile and add.
For now -- will close this question