Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: DBI/ODBC error: "Optional feature not implemented (SQL-HYC00)"

by mje (Curate)
on Sep 25, 2013 at 12:31 UTC ( #1055673=note: print w/ replies, xml ) Need Help??


in reply to DBI/ODBC error: "Optional feature not implemented (SQL-HYC00)"

Just so you know, I am the current maintainer of DBD::ODBC. The optional feature not implemented error can occur for multiple reasons and although you think it happens when calling bind_param, in actual fact, bind_param ends up as multiple ODBC API calls. The first thing to do would be to work out where in those calls it failed. Since you have a recent DBI and DBD::ODBC you can do

set DBI_TRACE=DBD=x.log perl myscript.pl

and we can look at the last few hundred lines of the log to see what really is happening. If we need to go deeper you can enable ODBC tracing from your ODBC Administrator but I wouldn't right now.

However, having said all that, it is generally unwise to tell DBD::ODBC how to bind input parameters especially when using columns like bigints and date/time/timestamps. The reality of it is, that SQL Server knows what the types of the columns are, it can usually (although not always) describe them via SQLDescribeParam and it can convert them internally and in Perl all your data is string data anyway.

Also read Why am I getting errors with bound parameters?


Comment on Re: DBI/ODBC error: "Optional feature not implemented (SQL-HYC00)"
Download Code
Re^2: DBI/ODBC error: "Optional feature not implemented (SQL-HYC00)"
by HelenCr (Monk) on Sep 25, 2013 at 13:34 UTC
    Dear mje

    Nice meeting you, and thank you for your thoughtful post.

    I went ahead and got rid of the SQL type binding, and the program ran along happily.

    But this is a workaround.

    "...it can usually (although not always) describe them via SQLDescribeParam and it can convert them internally..."
    The reason I added the SQL typing in the first place, was because I've encountered a situation where Perl didn't know that the incoming insert was a string, and thought it was an integer (that happens when you have a subroutine in one package, doing the execute_array, and the original call is outside the package).

    "...in Perl all your data is string data anyway..."
    I have several cases where the table index is an integer, not a string.

    Referring to your suggestion:
    set DBI_TRACE=DBD=x.log
    where is that command entered? at the command line DOS window? and is x.log the filename?
    I'll use it next time I hit a DBI/DBD::ODBC error.

    Many TIA

    Helen

      I'm not saying there are no situations where a type should be specified (in fact the faq I pointed to you at illustrates one).

      You look to be using two different ODBC drivers (or at least two different versions). You could find one needs the overriding and the other does not. We cannot tell that without seeing the log.

      The biggest problem with SQLDescribeParam (what DBD::ODBC uses to find the parmeter types out) is that the ODBC driver has to rearrange your SQL to find the column types and sometimes it can get this wrong i.e., some sql statements can work, and some can fail. DBD::ODBC tries very hard to get around this.

      My point about all your data is a string, is that as far as DBD::ODBC is concerned it is a string - it is bound with a SQL_VARCHAR or SQL_WVARCHAR. The binding type you pass to bind_param overrides the type passed to SQLBindParameter telling the driver what to convert it to - there is a subtle difference.

      If you can reproduce the issue you found with I've encountered a situation where Perl didn't know that the incoming insert was a string, and thought it was an integer I would love to see it as that doesn't sound at all right to me.

      I assumed you were running on windows so the set command would be issued in a command shell (followed by running your perl program) and would tell DBD::ODBC to send all trace output to x.log. If you are on Unix it would be "export DBI_TRACE=DBD=x.log". I'd very much like to see your trace output for the original problem you outlined (with the parameter types as you first had them).

        mje: I have to work on a different project branch right now, but I'll return to this within about a week or so, try to reproduce the error, (+ trace), and report.

        Many thanks

        Helen

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1055673]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2014-11-21 19:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (114 votes), past polls