Thread: RE: [cx-oracle-users] Time out parameter for connect?
Brought to you by:
atuining
From: Molina, G. <Ger...@sc...> - 2005-10-24 22:52:02
|
Anthony, Thanks for the quick response. I'd like to be able to specify a timeout parameter as in this example: connection =3D cx_Oracle.connect(user,password,dbstring,timeout)=20 where the connection would timeout after timeout expires. This would allow you to control max time per connection call. Do you need any more information? Thanks, Gerardo -----Original Message----- From: cx-...@li... [mailto:cx-...@li...] On Behalf Of Anthony Tuininga Sent: Monday, October 24, 2005 2:00 PM To: cx-...@li... Subject: Re: [cx-oracle-users] Time out parameter for connect? Could you provide more information about what you desire? A quick Google search indicates that there is a "timeout" parameter for the OCITransStart() call but that's all. Is that what you are referring to? If not, what are you referring to? Depending on what you need and what platform you are running on, one option is to create a thread with a timer and upon the expiration of the timer cancel the cursor if its still running. You can't do this on Windows -- you probably need the OCITransSatart() call for that purpose. Its not wrapped by cx_Oracle today so I'd need more information if you want me to implement it. On 10/24/05, Molina, Gerardo <Ger...@sc...> wrote: > > > Is there a way to specify a timeout parameter to the connect method? > > Or, is there another way to incorporate a timeout parameter for cx_Oracle? > > Thanks, > Gerardo ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: Molina, G. <Ger...@sc...> - 2005-10-25 15:34:42
|
What I was looking for was a timeout associated with an attempted connect, not a timeout for after the connection is established. Basically, I'm trying to reduce the the time spent waiting for a TCP timeout if host is off the air. I was looking for something like the timeout parameter in the pexpect module. Thanks, Gerardo=20 -----Original Message----- From: cx-...@li... [mailto:cx-...@li...] On Behalf Of Anthony Tuininga Sent: Tuesday, October 25, 2005 7:06 AM To: cx-...@li... Subject: Re: [cx-oracle-users] Time out parameter for connect? Hmm, I think more information is definitely needed. What precisely do you want? A timeout on the actual connect itself? A timeout on each statement that is executed by the connection? A timeout on something else? The only OCI (Oracle Call Interface) method that deals with timeouts is OCITransStart() and requires implicit transactions started for you. Be aware of another option (depending on your needs) in the creation of profiles on the Oracle database -- those allow you to specify a fair number of parameters. On 10/24/05, Molina, Gerardo <Ger...@sc...> wrote: > Anthony, > > Thanks for the quick response. > > I'd like to be able to specify a timeout parameter as in this example: > > connection =3D cx_Oracle.connect(user,password,dbstring,timeout) > > where the connection would timeout after timeout expires. > > This would allow you to control max time per connection call. > > Do you need any more information? > > Thanks, > Gerardo > -----Original Message----- > From: cx-...@li... > [mailto:cx-...@li...] On Behalf Of=20 > Anthony Tuininga > Sent: Monday, October 24, 2005 2:00 PM > To: cx-...@li... > Subject: Re: [cx-oracle-users] Time out parameter for connect? > > Could you provide more information about what you desire? A quick=20 > Google search indicates that there is a "timeout" parameter for the > OCITransStart() call but that's all. Is that what you are referring to? > If not, what are you referring to? Depending on what you need and what > platform you are running on, one option is to create a thread with a=20 > timer and upon the expiration of the timer cancel the cursor if its=20 > still running. You can't do this on Windows -- you probably need the > OCITransSatart() call for that purpose. Its not wrapped by cx_Oracle=20 > today so I'd need more information if you want me to implement it. > > On 10/24/05, Molina, Gerardo <Ger...@sc...> wrote: > > > > > > Is there a way to specify a timeout parameter to the connect method? > > > > Or, is there another way to incorporate a timeout parameter for > cx_Oracle? > > > > Thanks, > > Gerardo > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. > Get Certified Today * Register for a JBoss Training Course Free=20 > Certification Exam for All Training Attendees Through End of 2005=20 > Visit http://www.jboss.com/services/certification for more information > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. > Get Certified Today * Register for a JBoss Training Course Free=20 > Certification Exam for All Training Attendees Through End of 2005=20 > Visit http://www.jboss.com/services/certification for more information > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: Richard M. <ri...@we...> - 2005-10-25 15:39:59
|
Molina, Gerardo wrote: > What I was looking for was a timeout associated with an attempted > connect, not a timeout for after the connection is established. > Basically, I'm trying to reduce the the time spent waiting for a TCP > timeout if host is off the air. I was looking for something like the > timeout parameter in the pexpect module. You use an alarm call, possibly something like http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307871 but I guess this might lead to a resource leak. Rich. -- Richard Moore, Principal Software Engineer, Westpoint Ltd, Albion Wharf, 19 Albion Street, Manchester, M1 5LN, England Tel: +44 161 237 1028 Fax: +44 161 237 1031 |
From: Anthony T. <ant...@gm...> - 2005-10-25 17:28:54
|
I don't believe there is any method in the OCI that allows you to specify this value. Googling certainly suggests as much (others have asked for this capability and been told that it does not exist). Note that SQL*Net does allow you to specify such things so perhaps you need to look at the SQL*Net configuration. On 10/25/05, Richard Moore <ri...@we...> wrote: > > > Molina, Gerardo wrote: > > What I was looking for was a timeout associated with an attempted > > connect, not a timeout for after the connection is established. > > Basically, I'm trying to reduce the the time spent waiting for a TCP > > timeout if host is off the air. I was looking for something like the > > timeout parameter in the pexpect module. > > You use an alarm call, possibly something like > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307871 > but I guess this might lead to a resource leak. > > Rich. > -- > Richard Moore, Principal Software Engineer, > Westpoint Ltd, > Albion Wharf, 19 Albion Street, Manchester, M1 5LN, England > Tel: +44 161 237 1028 > Fax: +44 161 237 1031 > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. > Get Certified Today * Register for a JBoss Training Course > Free Certification Exam for All Training Attendees Through End of 2005 > Visit http://www.jboss.com/services/certification for more information > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Paul M. <p.f...@gm...> - 2005-10-25 19:46:24
|
On 10/25/05, Anthony Tuininga <ant...@gm...> wrote: > I don't believe there is any method in the OCI that allows you to > specify this value. Googling certainly suggests as much (others have > asked for this capability and been told that it does not exist). Note > that SQL*Net does allow you to specify such things so perhaps you need > to look at the SQL*Net configuration. I have certainly wanted this and never found a suitable way of managing it. You can do the connect in a thread, and wait for the thread to complete for a set time. If the connection hasn't been made by then, you can do whatever you want on a timeout (report an error, whatever). But if you then want to end your program, you'll need to wait for the thread - if you don't (for example, by making the thread a daemon) I've found you can get odd crashes or other errors (I never worked out why, or managed to put together a useful test case - I just marked it down as "don't do that"). I'm not quite sure how you configure SQL*Net to time out after a given period. I remember looking, but I don't recall finding any suitable parameter. Paul. |
From: Molina, G. <Ger...@sc...> - 2005-10-25 20:21:40
|
The only parameter I'm aware of relating to timeout on sqlnet is sqlnet.expire_time. But this is for disconnecting idle sessions after a specified amount of time. This is not exactly what I'm looking for - terminating an attempted connect after a specified amount of time. I very much appreciate the insightful feedback everyone has given already. Thanks, Gerardo=20 -----Original Message----- From: cx-...@li... [mailto:cx-...@li...] On Behalf Of Paul Moore Sent: Tuesday, October 25, 2005 12:46 PM To: cx-...@li... Subject: Re: [cx-oracle-users] Time out parameter for connect? On 10/25/05, Anthony Tuininga <ant...@gm...> wrote: > I don't believe there is any method in the OCI that allows you to=20 > specify this value. Googling certainly suggests as much (others have=20 > asked for this capability and been told that it does not exist). Note=20 > that SQL*Net does allow you to specify such things so perhaps you need > to look at the SQL*Net configuration. I have certainly wanted this and never found a suitable way of managing it. You can do the connect in a thread, and wait for the thread to complete for a set time. If the connection hasn't been made by then, you can do whatever you want on a timeout (report an error, whatever). But if you then want to end your program, you'll need to wait for the thread - if you don't (for example, by making the thread a daemon) I've found you can get odd crashes or other errors (I never worked out why, or managed to put together a useful test case - I just marked it down as "don't do that"). I'm not quite sure how you configure SQL*Net to time out after a given period. I remember looking, but I don't recall finding any suitable parameter. Paul. ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |
From: Anthony T. <ant...@gm...> - 2005-10-26 13:52:46
|
Oops. You're right. Expire time is what I was thinking of but that is only for expiring idle sessions as you said. So I believe there is no way of doing this directly using Oracle alone. If anyone knows otherwise, I'd be happy to be enlightened. :-) On 10/25/05, Molina, Gerardo <Ger...@sc...> wrote: > The only parameter I'm aware of relating to timeout on sqlnet is > sqlnet.expire_time. But this is for disconnecting idle sessions after a > specified amount of time. This is not exactly what I'm looking for - > terminating an attempted connect after a specified amount of time. > > I very much appreciate the insightful feedback everyone has given > already. > > Thanks, > Gerardo > > -----Original Message----- > From: cx-...@li... > [mailto:cx-...@li...] On Behalf Of Paul > Moore > Sent: Tuesday, October 25, 2005 12:46 PM > To: cx-...@li... > Subject: Re: [cx-oracle-users] Time out parameter for connect? > > On 10/25/05, Anthony Tuininga <ant...@gm...> wrote: > > I don't believe there is any method in the OCI that allows you to > > specify this value. Googling certainly suggests as much (others have > > asked for this capability and been told that it does not exist). Note > > that SQL*Net does allow you to specify such things so perhaps you need > > > to look at the SQL*Net configuration. > > I have certainly wanted this and never found a suitable way of managing > it. > > You can do the connect in a thread, and wait for the thread to complete > for a set time. If the connection hasn't been made by then, you can do > whatever you want on a timeout (report an error, whatever). > But if you then want to end your program, you'll need to wait for the > thread - if you don't (for example, by making the thread a daemon) I've > found you can get odd crashes or other errors (I never worked out why, > or managed to put together a useful test case - I just marked it down as > "don't do that"). > > I'm not quite sure how you configure SQL*Net to time out after a given > period. I remember looking, but I don't recall finding any suitable > parameter. > > Paul. > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. > Get Certified Today * Register for a JBoss Training Course Free > Certification Exam for All Training Attendees Through End of 2005 Visit > http://www.jboss.com/services/certification for more information > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. > Get Certified Today * Register for a JBoss Training Course > Free Certification Exam for All Training Attendees Through End of 2005 > Visit http://www.jboss.com/services/certification for more information > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |
From: Anthony T. <ant...@gm...> - 2005-10-25 14:06:18
|
Hmm, I think more information is definitely needed. What precisely do you want? A timeout on the actual connect itself? A timeout on each statement that is executed by the connection? A timeout on something else? The only OCI (Oracle Call Interface) method that deals with timeouts is OCITransStart() and requires implicit transactions started for you. Be aware of another option (depending on your needs) in the creation of profiles on the Oracle database -- those allow you to specify a fair number of parameters. On 10/24/05, Molina, Gerardo <Ger...@sc...> wrote: > Anthony, > > Thanks for the quick response. > > I'd like to be able to specify a timeout parameter as in this example: > > connection =3D cx_Oracle.connect(user,password,dbstring,timeout) > > where the connection would timeout after timeout expires. > > This would allow you to control max time per connection call. > > Do you need any more information? > > Thanks, > Gerardo > -----Original Message----- > From: cx-...@li... > [mailto:cx-...@li...] On Behalf Of > Anthony Tuininga > Sent: Monday, October 24, 2005 2:00 PM > To: cx-...@li... > Subject: Re: [cx-oracle-users] Time out parameter for connect? > > Could you provide more information about what you desire? A quick Google > search indicates that there is a "timeout" parameter for the > OCITransStart() call but that's all. Is that what you are referring to? > If not, what are you referring to? Depending on what you need and what > platform you are running on, one option is to create a thread with a > timer and upon the expiration of the timer cancel the cursor if its > still running. You can't do this on Windows -- you probably need the > OCITransSatart() call for that purpose. Its not wrapped by cx_Oracle > today so I'd need more information if you want me to implement it. > > On 10/24/05, Molina, Gerardo <Ger...@sc...> wrote: > > > > > > Is there a way to specify a timeout parameter to the connect method? > > > > Or, is there another way to incorporate a timeout parameter for > cx_Oracle? > > > > Thanks, > > Gerardo > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. > Get Certified Today * Register for a JBoss Training Course Free > Certification Exam for All Training Attendees Through End of 2005 Visit > http://www.jboss.com/services/certification for more information > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. > Get Certified Today * Register for a JBoss Training Course > Free Certification Exam for All Training Attendees Through End of 2005 > Visit http://www.jboss.com/services/certification for more information > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |