in reply to win32::odbc/ SQL error

I am 90% sure that you're problem is that the database connection is failing. This would result in your database handle being undefined. Invalid username/password combo, non-exitsent database, something like that. The fix is to change your first line to the following and examine the error message produced:

my $db = new Win32::ODBC('user_logons') or die "db connect failed: $!";


If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

Replies are listed 'Best First'.
Re: Re: win32::odbc/ SQL error
by billie_t (Sexton) on May 23, 2003 at 01:28 UTC
    Yes, of course I should have put error handling in. D'oh! However, after doing so, I'm not getting any connect errors. I'll go and check those field names again...
      ... <Data> probably should just be data or data when you have table or column names that have spaces in them you use square brackets ex: SELECT data.first name, data.last name, machine.user name FROM data, user WHERE ... blah, blah...the error you are seeing is because the DB is telling it.. <DATA> is not a name of a table unless you named your table '<DATA>'?
      I do have one suggestion... try DBI, just my 2cents... JamesNC
      After inserting the error checking, are you geting the same error message? Your previous error message indicated that the $db variable was not defined. That indicates that your 'new' statement is failing. Fix that before moving on.

      I agree with JamesNC. I would use DBI. The knowledge you gain from using it on MS SQL would be (mostly) transferable to Oracle, mysql, etc. Just my 2 cents.

      Most importantly, don't give up. Keep plugging away. It's worth it.