As I'm new to python.
I need to know simple database connectivity with Apache HTTP Server.
Just I need to run the below code in Apache HTTP Server.
import pyodbc
cnxn = pyodbc.connect("Driver={ODBC Driver 13 for SQL Server};"
"Server=DESKTOP-C6;"
"Database=demo2017;"
"Trusted_Connection=yes;")
cursor = cnxn.cursor()
cursor.execute('SELECT * FROM person')
for row in cursor:
print('row = %r' % (row,))
cursor.close();
cnxn.close();
I have tried to run in python shell. It executed successfully.
But with Apache HTTP Server results in 500 Internal Server Error.
Also in httpd.conf file:
LoadModule pyodbc_module "c:/users/desktop/appdata/local/programs/python/python36-32/lib/site-packages/pyodbc.cp36-win32.pyd"
Results
httpd: Syntax error on line 571 of C:/Apache24/conf/httpd.conf: Can't
locate API module structure `pyodbc_module' in file
C:/Users/Desktop/AppData/Local/Programs/Python/Python36-32/Lib/site-packages/pyodbc.cp36-win32.pyd:
No error
So are there any modules or code that should be imported/modified to run with Apache?