I have an mssql database, the data from which has to be processed in a certain way. For that, I have own python packages that does the authentication and does all the required processing (there are multiple functions) on the data to give the output. For my overall workflow, I want to use these functions, without having to create a redundant workflow that does the same functions as the python packages. So I created a Conda environment with python 3.10 and installed these packages into them.
When I test the environment with VS code, it works perfectly, i.e. it can access the data and do the processing as needed. However, the same does not work in Knime.
Here are the things I did:
- I am using the Python legacy node
- I set the preferences to use the new Conda environment that I created (both in legacy and scripting)
This is the error that I get:
type object ‘java.sql.Types’ has no attribute ‘javaclass’
Traceback (most recent call last):
File “”, line 8, in
File “C:\Users\me\AppData\Local\miniforge3\envs\knime_python_venv\lib\site-packages\my_package_1\db.py”, line 21, in init
self.db_conn = self._conn(path_to_jar, path_to_auth_dll)
File “C:\Users\me\AppData\Local\miniforge3\envs\knime_python_venv\lib\site-packages\my_package_1\db.py”, line 25, in _conn
return jaydebeapi.connect(self.conf.jdbc_class, self.conf.jdbc_url, self.params, path_to_jar, path_to_auth_dll)
File “C:\Program Files\Knime AP 5.2.0\plugins\org.knime.python2_5.2.0.v202311211447\py\jaydebeapi.py”, line 384, in connect
jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
File “C:\Program Files\Knime AP 5.2.0\plugins\org.knime.python2_5.2.0.v202311211447\py\jaydebeapi.py”, line 186, in _jdbc_connect_jpype
for i in types.javaclass.getClassFields():
AttributeError: type object ‘java.sql.Types’ has no attribute ‘javaclass’. Did you mean: ‘class’?
I dug a bit deeper as it seems like the problem lies with the Jaydebeapi.py which apparently is responsible for the authentication. I used the following script in the Knime python node to check:
import imp
#location_check default
print("default loaction is: ", imp.find_module(‘pandas’))
#location of jaydebeapi
print(imp.find_module(‘JayDeBeApi’))
print(imp.find_module(‘JPype’))
The output is:
default loaction is: (None, ‘C:\Users\me\AppData\Local\miniforge3\envs\knime_python_venv\lib\site-packages\pandas’, (‘’, ‘’, 5))
(<_io.TextIOWrapper name=‘C:\Program Files\Knime AP 5.2.0\plugins\org.knime.python2_5.2.0.v202311211447\py\JayDeBeApi.py’ mode=‘r’ encoding=‘utf-8’>, ‘C:\Program Files\Knime AP 5.2.0\plugins\org.knime.python2_5.2.0.v202311211447\py\JayDeBeApi.py’, (‘.py’, ‘r’, 1))
(None, ‘C:\Users\me\AppData\Local\miniforge3\envs\knime_python_venv\lib\site-packages\JPype’, (‘’, ‘’, 5))
Fo some reason, while pandas and jpype are correctly pointed, for the Jaydebeapi.py it does not go into my python environment, but into a default one from Knime. And that too, it seems like in Python 2 (from the folder name).
I checked everywhere in the preferences, Python 2 has not been set anywhere.
What could be the problem here? Is there some setting that I am missing?