... das wäre die Antwort auf einen DB Zugriff mit Python:
Code:
import pyodbc
# Connection string
connection_string = "DRIVER={iSeries Access ODBC Driver};SYSTEM=your_system_name;UID=your_username;PWD=your_password"
# Connect to the database
conn = pyodbc.connect(connection_string)
# Create a cursor object
cursor = conn.cursor()
# Execute a SQL statement
cursor.execute("SELECT * FROM YOUR_LIBRARY.YOUR_TABLE")
# Fetch all rows
rows = cursor.fetchall()
# Iterate through the rows and print the data
for row in rows:
print(row)
# Close the cursor and connection
cursor.close()
conn.close()
Bookmarks