What Should Be My Configuration To Load Pyodbc Module On Apache Server To Run Simple Queries Mssql Server Database
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.con
Solution 1:
You're missing several layers to your stack, which are really good ideas to learn and use if you want to leverage pyodbc
:
- Apache (installed) mod_wsgi (WSGI is a specification that describes how a web server communicates with web applications)
- A framework to protect you from very bad things happening
However, if all you want is for that to appear on a web page, you can do it as a CGI program. This is a bad idea, but is quick and dirty.
You'll need to add this before any output (before for row
):
print("Content-Type: text/html;charset=utf-8")
print()
And then follow these instructions to configure Apache to run your Python script: https://www.linux.com/blog/configuring-apache2-run-python-scripts
Post a Comment for "What Should Be My Configuration To Load Pyodbc Module On Apache Server To Run Simple Queries Mssql Server Database"