Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is There Any Way to set timeout on jaydebeapi execute? #157

Closed
panickery opened this issue Jun 24, 2020 · 2 comments
Closed

Is There Any Way to set timeout on jaydebeapi execute? #157

panickery opened this issue Jun 24, 2020 · 2 comments

Comments

@panickery
Copy link

   conn = jaydebeapi.connect(
       conf_dict['jdbc_driver_class'],`
       conf_dict['jdbc_connection_string'],
       [db_id, db_pw],     
       conf_dict['jdbc_driver_library'] )

    logging.debug('CONNECT_SUCCESS!')
    cur = conn.cursor()
    logging.debug('BEFORE EXECUTE!')
    logging.debug('EXECUTE QUERY :: {}'.format(query))
    cur.execute(query)
    logging.debug('AFTER EXECUTE!')  <-- not printed

I always thanks for jaydebeapi.
above code is in my script
most time this script works well, but some big query doen'st work well
query execute never ends and the process of python script too.
so I want set timeout to execute, How can i set timeout on 'execute'?
thank you

@baztian
Copy link
Owner

baztian commented Jun 25, 2020

Usually there are system parameters you can set depending on the JDBC driver/vendor. Are you using the Jaydebeapi on CPython or on Jython? To be able to pass system parameters you currently have to start JPype beforehand. This way you can add commandline args if I remember correctly using '-Dkey=value'. Once #116 has been properly integrated this could be added to the connect method.

Another approach would be JDBC 4.1. But this isn't supported directly by JayDeBeApi either at the moment. https://stackoverflow.com/questions/18822552/setting-network-timeout-for-jdbc-connection might give you some more detail on that.

@panickery
Copy link
Author

Thank you For the answer.
I'm using Python and your answer is quite helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants