This forum is appropriate.

It has been a number of years since I looked at the code I used for what
you ask (perhaps I have an old copy of source laying around) but if I
recall correctly, I used the OLE DB Provider.  I am not aware of any
licensing issues -- perhaps the company already had some kind of license I
did not know about. Anybody who can afford to run an AS-400 should not
shrink from the cost of a license to actually access the data that it
hosts, I suppose.

My best source for finding how to connect with anything is
https://www.connectionstrings.com/.  Since C-Python cannot run .NET code,
you cannot use any of the .NET connection methods.
I think the method you want will be based on
https://www.connectionstrings.com/ibm-client-access-ole-db-provider/


Pull and install the zip file from http://sourceforge.net/projects/adodbapi
which has some documentation and samples that don't get shipped with
pywin32. (The PIP install from pypi is the same thing,too.) The SQL-Server
and ACCESS examples both use OLE-DB providers so get your ideas from them.
The samples and the quickstart document ought to get you going. If not,
feel free to email me directly.

Of course, you will have to get DB-2 provider software from IBM or
somewhere.  (That may be where they get you with a license fee.) Also, be
aware that the OLE-DB provider is complete/y different from the ODBC
driver. You can use either one from adodbapi, but the connection string is
completely different.

Once you have all of the correct software installed and permissions and
passwords set up, the database manipulation itself is very straight
forward, and adodbapi has enhancements to eliminate some of the worst
problems with SQL, such as argument counting.  DB-2 hums along quite
nicely.  In my best production application, I was pulling customer data
from a distant AS-400 and combining it with local GIS data.  Having the
geographical data on a Microsoft SQL Server turned out to be a severe
bottleneck. But, since everything was written using the Python DB-API, it
was easy to convert to using MySQL locally (which worked quite well) and
then to sqlite3, which became the final solution. Note that (even though
adodbapi can do some magic) you are still talking in the SQL dialect of the
target database engine. Don't expect to send Microsoft T-SQL commands to a
DB-2 server.

Good luck.


On Thu, Jun 22, 2017 at 10:20 PM, Gugu Rama <gulsumramazano...@gmail.com>
wrote:

> Hi everybody, I am new here and need an answer, if you can help I will be
> really happy...
>
> I just wonder a point about connecting to an AS400 DB2 over Python.. To
> connect to a DB2 of a remote AS400 over any one of the Python DB API
> interfaces (ibm_db, pyodbc, pyDB2 or any other one) from Python on
> Windows10, in any case do we have to pay for the license of the IBM ODBC
> driver? I tried ibm_db and it seems its for free to connect to a DB2 on
> Windows, but due to pay for a license to connect to a remote AS400.. Is
> there any other way of connecting to a remote AS400 without IBM licensing
> "solutions", from Python3.x?...
>
> BTW if here is not the proper email list to ask this kind of a question,
> would you please lead me to another one if its more fitting for such a
> question.. for I am new in Python, I try to learn proper community grounds
> for Q&A as well..
>
> Thank you in advance..
>
> _______________________________________________
> python-win32 mailing list
> python-win32@python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to