我正在使用非常标准的语法连接到数据库。
如何在此处更改默认超时值?
需要设置在驱动还是jdbc级别?
jaydebeapi 文档没有提到这一点。
jaydebeapi-connection.py 的源代码
## 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, ...)