Ok -- I did make some changes in ping because some databases reported the
"prepare" went OK, but the execute didn't run.  They were probably not
"sending" the query to the server until the execute, a downside of which is
what appears to be happening here.  In your first version, the prepare
succeeds so we think the DB is running, but the second version tries to
execute it and then gets the error.  In some cases, the first ping wouldn't
work because the client is caching the data.

Just out of curiosity, have you ever shutdown the server and tried the ping
in the old version?

Anyway, my next version will add S1000 to the list, but I'm a little nervous
about it.  It's worth trying, but I think that S1000 is such a "catch all"
error that it could include an error such as "can't communicate with the
server".  That would falsely tell ping that things are still alive.
Unfortunately, this is VERY driver/database dependant.

I would suggest setting up a test, where you connect, sleep 60 seconds,
ping, sleep, ping, etc, then
        a) take down the Open link software server and see the results
        b) start over with everything up and then take down the db server and see
the results.

The DBI tracing is the most helpful in examining these things.

You can test by editing your ODBC.pm, find the ping method and add the line:
        return 1 if $state eq 'S1000';  # General Error? ? 5/30/02, JLU.  This is
what Openlink is returning
right below some of the other return 1 if $state...

Jeff


[snip]

[old DBD::ODBC 0.28]
> 2   <- prepare('select col_does_not_exist from table_does_not_exist')=
> DBI::st=HASH(0x81e252c) at ODBC.pm line 143.
> 2   <- state= '' at ODBC.pm line 145.
>     <- ping= 1 at openlink.pl line 237.

[new]
> 2   <- prepare('select sysdate from dual1__NOT_FOUND__CANNOT' CODE)=
> DBI::st=HASH(0x825e0ec) at ODBC.pm line 184
>     !! ERROR: -1 '[OpenLink][ODBC][SQL Server]Invalid object name
> 'dual1__NOT_FOUND__CANNOT'. (SQL-S1000)(DBD:
> st_execute/SQLExecute err=-1)'
>     <- execute(CODE)= undef at ODBC.pm line 191
> 2   <- state= 'S1000' at ODBC.pm line 193
>     <- DESTROY= undef at ODBC.pm line 199
>     <- ping= 0 at openlink_trace.pl line 237





Reply via email to