微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 Denodo 驱动程序更改超时 jaydebeapi

如何解决使用 Denodo 驱动程序更改超时 jaydebeapi

我使用非常标准的语法连接到数据库

此处如何更改认超时值?

需要在驱动还是jdbc级别设置?

jaydebeapi 文档没有提到这一点。

jaydebeapi-connection.py 的来源

https://community.denodo.com/kb/view/document/How%20to%20connect%20to%20Denodo%20from%20Python%20-%20a%20starter%20for%20Data%20Scientists?category=Northbound+Connections

   ## script name: jaydebeapi-connection.py

## Importing the main library used to connect to Denodo via JDBC
import jaydebeapi as dbdriver

## Importing the gethostname function from socket to
## put the hostname in the useragent variable
from socket import gethostname


# Connection parameters of the Denodo Server that we are connecting to
denodoserver_name = "denodoserver"

# This is the standard port for jdbc connections
denodoserver_jdbc_port = "9999"

denodoserver_database = "distributed_tpcds"

denodoserver_uid = "tpcds_usr"

denodoserver_pwd = "tpcds_usr"

denododriver_path = "/opt/denodo/8.0/tools/client-drivers/jdbc/denodo-vdp-jdbcdriver.jar"

## Create the useragent as the concatenation of
## the client hostname and the python library used
client_hostname = gethostname()
useragent = "%s-%s" % (dbdriver.__name__,client_hostname)

## Creating a variable with the connection uri. We add here the UserAgent
## so the query can be better identified on the server. To append parameters you
## can use the Syntax <param_name>=<param_value> and separate them with '&'.
## The full list of accepted parameters is available here
## https://community.denodo.com/docs/html/browse/7.0/vdp/developer/
##        access_through_jdbc/parameters_of_the_jdbc_connection_url/
##        parameters_of_the_jdbc_connection_url
conn_uri = "jdbc:vdb://%s:%s/%s?userAgent=%s" % (denodoserver_name,denodoserver_jdbc_port,denodoserver_database,useragent)
                                                                                           
cnxn = dbdriver.connect( "com.denodo.vdp.jdbc.Driver",conn_uri,driver_args = {"user": denodoserver_uid,"password": denodoserver_pwd},jars = denododriver_path
                              )

## Query to be sent to the Denodo VDP Server
query = "select * from bv_store_returns"

## Define a cursor and execute the results
cur = cnxn.cursor()
cur.execute(query)

## Finally fetch the results. `results` is a list of tuples,## If you don't want to load all the records in memory,## you may want to use cur.fetchone() or cur.fetchmany()
results = cur.fetchall()

# >> len(results)
# 287514
# >> type(results)
# list
# >> type(results[0])
# tuple
# >> results[0]
# (2451794,40096,1,7157,910283,6421,37312,...)

解决方法

您实际上可以通过更改 JDBC 驱动程序配置(添加驱动程序参数 'queryTimeout')或通过查询本身的 CONTEXT 子句 (https://community.denodo.com/docs/html/browse/latest/en/vdp/vql/queries_select_statement/context_clause/context_clause) 来实现

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?