0

我正在尝试通过 python 连接到加密的 exasol 数据库。未加密时,它可以毫无问题地连接。

EXASOL.connect 似乎基于 pyodbc,有没有人成功使用 pyodbc 并打开加密?

我尝试根据手册(第 343 页)将ENCRYPTION=Y作为字符串参数传递,但没有成功。

ENCRYPTION 打开自动加密。有效值为“Y”和“N”(默认为“N”)。

似乎它忽略了它。持续爆破 - OperationalError:数据库错误 [08004] 连接异常 - 客户端连接必须加密。

database_table = "SCHEMA_NAME.MY_TABLE"
conn = EXASOL.connect('ws://192.168.56.101:8563', 
                      'UID=sys', 
                      'PWD=pwd', 
                      'ENCRYPTION=Y', 
                      )

sql = "SELECT * FROM %s LIMIT 1000;" % database_table
df_sql = pd.read_sql(sql, conn)

/home/ec2-user/anaconda3/envs/mxnet_p27/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_cell_magic(self, magic_name, line, cell)
   2115             magic_arg_s = self.var_expand(line, stack_depth)
   2116             with self.builtin_trap:
-> 2117                 result = fn(magic_arg_s, cell)
   2118             return result
   2119 

<decorator-gen-60> in time(self, line, cell, local_ns)

/home/ec2-user/anaconda3/envs/mxnet_p27/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    186     # but it's overkill for just that one bit of state.
    187     def magic_deco(arg):
--> 188         call = lambda f, *a, **k: f(*a, **k)
    189 
    190         if callable(arg):

/home/ec2-user/anaconda3/envs/mxnet_p27/lib/python2.7/site-packages/IPython/core/magics/execution.pyc in time(self, line, cell, local_ns)
   1183         else:
   1184             st = clock2()
-> 1185             exec(code, glob, local_ns)
   1186             end = clock2()
   1187             out = None

<timed exec> in <module>()

/home/ec2-user/anaconda3/envs/mxnet_p27/lib/python2.7/site-packages/EXASOL/__init__.pyc in __init__(self, url, username, password, autocommit, queryTimeout, useCompression, typeMapper)
    324         self._inconnect = False
    325         self._type_mapper = typeMapper
--> 326         self._connect()
    327         self._login()
    328 

/home/ec2-user/anaconda3/envs/mxnet_p27/lib/python2.7/site-packages/EXASOL/__init__.pyc in _connect(self)
    417                 self._ws_send = self.__ws.send
    418                 self._ws_recv = self.__ws.recv
--> 419                 ret = self._req(command = 'login', protocolVersion = 1)
    420                 if CRYPTO_LIB == 'rsa':
    421                     if sys.version_info.major >= 3:

/home/ec2-user/anaconda3/envs/mxnet_p27/lib/python2.7/site-packages/EXASOL/__init__.pyc in _req(self, **req)
    407             raise OperationalError('%s [%s] %s' % ('database error',
    408                                                    rep['exception']['sqlCode'],
--> 409                                                    rep['exception']['text']))
    410         raise OperationalError('internal error: %s' % repr(rep))
    411 

OperationalError: database error [08004] Connection exception - Client connection must be encrypted.
4

1 回答 1

0

PyEXASOL驱动程序支持 WebSocket 协议和 HTTP 传输的加密。

您需要做的就是将encryption=True传递给连接选项。

于 2018-06-19T17:05:44.880 回答