hello i´m trying to configure an mssql resolver to get users from an external application. installation done described in this LinOTP Howto (https://www.linotp.org/howtos/howto-mssql_pyodbc.html) , but i got module and plugin errors.
[privacyidea.lib.user:661] ModuleNotFoundError(“No module named ‘pyodbc’”,)
Hello Hans,
welcome to privacyIDEA.
If you installed privacyIDEA from the repositories it is running in a python virtualenv in /opt/privacyidea.
I.e. pyodbc must be installed in the virtualenv - not via apt.
When Your virtualenv is located in /opt/privacyidea/ You can call $ source /opt/privacyidea/bin/activate which will activate the virtualenv. Then just call $ pip install pyodbc. With deactivate You can leave the virtualenv again.
due this note pyodbc is installed, but now i got another error when i try to connect MSSQL Database
privacyidea.lib.user:661] InterfaceError("(pyodbc.InterfaceError) (‘IM002’, ‘[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)’)",)
sorry it’s not really clear for me, where this connection string will be configured, maybe you give an example ?
what i done in the meantime, adding the specific driver to use and the driver error is gone
[MSSQL Resolver Configuration]
[Output privacyidea.log]
[2020-07-20 06:06:17,882][34428][140247436535552][INFO][privacyidea.lib.resolvers.SQLIdResolver:557] using the connect string mssql+pyodbc:///?odbc_connect=DRIVER={FreeTDS}://UserDB:TopSecret@192.168.30.11:1433/Test
[2020-07-20 06:06:17,887][34428][140247436535552][ERROR][privacyidea.lib.user:661] OperationalError("(pyodbc.OperationalError) (‘08001’, ‘[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)’)",)
[2020-07-20 06:06:19,384][34428][140247503677184][ERROR][privacyidea.lib.user:661] OperationalError("(pyodbc.OperationalError) (‘08001’, ‘[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)’)",)
We build the connect string from the fields in the following form: {driver}://{user}:{password}@{server}:{port}/{databse}?{connectionParams}
So we currently can not pass through the exact PyODBC string, instead the hostname based connect string must be used (pieced together from the given fields): https://docs.sqlalchemy.org/en/13/dialects/mssql.html#connecting-to-pyodbc