×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
You mean, effectively, connect from Python, correct?
*ODBC* for choice.
Driver comes in the Application Package with iACS.
On Wed, Nov 18, 2020 at 8:24 AM Quintin Holmberg <qholmberg@xxxxxxxxxxxxxxxx>
wrote:
For those of you who are, what method did you use to connect to the IBMi
databases?
Here's my (sanitized) .odbc.ini on my workstation:
[IEXAMPLE]
Description=IBM i Access ODBC Driver
Driver=IBM i Access ODBC Driver
System=iexample.example.com
UserID=jwoehr
Password=foobar2u
Naming=0
DefaultLibraries=QGPL
Database=A1234567
ConnectionType=0
CommitMode=2
ExtendedDynamic=1
DefaultPkgLibrary=QGPL
DefaultPackage=A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression=1
MaxFieldLength=32
BlockFetch=1
BlockSizeKB=128
ExtendedColInfo=0
LibraryView=ENU
AllowUnsupportedChar=0
ForceTranslation=0
Trace=0
Here's a connect example:
import pyodbc
cn = pyodbc.connect("DSN=IEXAMPLE")
cursor = cn.cursor()
cursor.tables()
rows = cursor.fetchall()
for row in rows:
print(row.table_name)
cursor.close()
cursor = cn.cursor()
try:
cursor.execute("Select * from ICECREAMP") # in default library QGPL
(see odbc.ini above)
rows = cursor.fetchall()
for row in rows:
print(row)
except:
print('cursor.execute("Select * from ICECREAMP") didn''t work.')
finally:
cursor.close()
As an Amazon Associate we earn from qualifying purchases.