Thanks for the support, I was able to solve the problem. The solution was to set an option from the control panel, administrative tools, DataSources (ODBC), the option was Run in Quiet Mode.
Whit this option the message doesn�t appear and the execution thread goes out the scope of the eval. Thanks -----Original Message----- From: Lincoln A. Baxter [mailto:[EMAIL PROTECTED] Sent: S�bado, 28 de Agosto de 2004 01:18 a.m. To: Arias, Esteban Ariel; Henri Asseily Cc: [EMAIL PROTECTED] Subject: Re: DBI Connect Hang when no Network is available If this is on Windows... Sys::SigAction will not help you. sigaction() is a POSIX (unix) function for signal handling. On most *ix flavored of OSes, Sys:SigAction will probably get your alarm to fire. And make it easy to setup. There is a sample oracle test script in the kit which illustrates its use. Background: I ran into exactly this problem when I upgraded to perl 5.8.0 a year ago. Took me nine-months... intermittently to figure out what was happening. At first I thought the problem was Oracle 9i. It was actually the combination of the interaction of how perl changed default signal handling (to make it "safe"), the way oracle OCI was calling the connect() system call (restartably). truss (solaris), or strace (gnu/linux) should show you the system calls being made, and be very revealing of what is really going on. http://search.cpan.org/~lbaxter/Sys-SigAction/ Lincoln On Fri, 2004-08-27 at 20:43, Henri Asseily wrote: > Try to use "RaiseError => 1", otherwise the DBI connect won't die and > the alarm won't be triggered. Or modify your connect statement to be: > > DBI->connect("dbi:ODBC:GARDEL","Gardel","Gardel",{RaiseError => 0}) or > die "DBI->errstr"; > > Also try to use the Sys::SigAction module by Lincoln Baxter and report > back. It abstracts all sorts of problems that different versions of Perl > have with signal handling. I've used it successfully when other methods > have failed. > > Caveat: I've never used DBI and ODBC on Win32, and I've never > encountered a modal dialog box. > > Arias, Esteban Ariel wrote: > > > Hi: > > > > This is an extract of test code of what I�m doing: > > > > use Carp; > > use DBI; > > use Data::Dumper; > > > > my $self = {}; > > > > eval { > > local $SIG{ALRM} = sub { die "TIMEOUT"; }; > > alarm 3; > > > > $self->{DBH} = > > DBI->connect("dbi:ODBC:GARDEL","Gardel","Gardel",{RaiseError => 0}); > > }; > > alarm 0; > > > > print Dumper ($self->{DBH}), " ", DBI->err, " ",DBI->errstr, "\n"; > > > > The problem is that when I try to connect to the database through DBI and > > there is no network, a message box appears saying: > > > > 10065 WSA E HostUnreach: The Teradata server can't currently be reached over > > this network. > > > > Furthermore the alarm sign doesn�t execute, and only when I hit OK button in > > the message box, the execution thread goes off the scope of the eval (exits) > > and just in that moment the message in the command line appears(print Dumper > > ...). > > > > I would rather prefer: > > 1) that the message box doesn�t appear, which it would imply that the alarm > > would ring. OR > > 2) If there is no way to override the message box, to automatically "HIT" > > the OK Button. > > > > Thanks in advance. > > > > > > > > >
