Solved

ODBC Error

Posted on 2008-06-23
9
820 Views
Last Modified: 2013-12-25
I am a perl developer and I recently came accross this error.  It is not a consistent error and I have tried strenuosly to recreate it without success.  If anyone can help here it would be greatly appreciated, I am basicly looking for what causes the problem and of coarse what to do in order to correct it.
0
Comment
Question by:harumb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 82

Assisted Solution

by:hielo
hielo earned 450 total points
ID: 21851468
What does your code look like? Are you perhaps querying the db and instead of checking to see if you actually got a record/result, you are assuming that you did and dereferencing non-existent records? Test for the existence of records before you actually attempt to dereference the resource.
0
 
LVL 14

Assisted Solution

by:Jagdish Devaku
Jagdish Devaku earned 50 total points
ID: 21853749
Hi,

Please refer to the following links which might help you...

http://support.microsoft.com/kb/110093

http://msdn.microsoft.com/en-us/library/ms710252(VS.85).aspx

all the best...
0
 

Author Comment

by:harumb
ID: 21855576
JagdishDevaku,

Thank you for the links but I am looking for specific causes for the error:

Describe failed during DBI::st=HASH(0x2dac6d0)->FETCH(NAME,0) at f:/Perl/site/lib/Win32/DBIODBC.pm line 172.

Of coarse the hex hash value would change.  I have been able to recreate this error after starting my application then disconnecting the database but so far that is the only way I have been able to re-create it.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 82

Assisted Solution

by:hielo
hielo earned 450 total points
ID: 21855744
Once again, what does your code look like? If I had to guess, you are dereferencing invalid object properties/methods.
0
 

Author Comment

by:harumb
ID: 21856136
hielo,

It is difficult to almost pin down the actual statement but I don't believe the object is invalid.  The method throwing the exception it being referenced by the object.   I have pasted the routine below where we think the error message originated from.

my $DBER = $DB->Sql(
                "SELECT number FROM hst WHERE site=$MSH_SITE AND
                acctnum='".$fields->{'acctnum'}."");
        $DB->FetchRow();

if($DB->Data('number') gt ' ') ...

This is one of our issues, for updates and inserts we do a check for a DBI error but with selects we don't.

hielo,

Have you seen this issue before?

Thanks.

Brad

0
 
LVL 82

Assisted Solution

by:hielo
hielo earned 450 total points
ID: 21856553
>>Have you seen this issue before?
Not identical (message wise) but very similar. We were having dns issues and there were times when the scripts were not able to find the server, so there was no active connection.

What does this refer to?
DBIODBC.pm line 172.
0
 

Author Comment

by:harumb
ID: 21856798
hielo,

Whoops I should mention that dbiodbc.pm is a rewrite of the odbc.pm we did.  All the functionality is still there in fact I attached it for you.  The main method though "FETCH" is not in the dbiodbc.pm module but is in the DBI.pm module.  If you saw this before from a dns problem, was it exactly like this error?  The system this error appeared on was using localhost for the odbc dsn server configuration setting.  Normally we don't do that this is just a test system I was on.

thanks.

Brad
DBIODBC.txt
0
 
LVL 82

Accepted Solution

by:
hielo earned 450 total points
ID: 21857583
above you have:
my $DBER = $DB->Sql(
                "SELECT number FROM hst WHERE site=$MSH_SITE AND
                acctnum='".$fields->{'acctnum'}."");
which is missing a closing apostrophe for acctnum='...'

other than that, the attached file has:
sub Sql
{
       my $self= shift;
       my $Sql = shift;
...
since in $DB->Sql('...') you are passing only one argument, the query string, I am wondering if those two lines should be reversed:
sub Sql
{
       my $Sql = shift;
       my $self= shift;
0
 

Author Closing Comment

by:harumb
ID: 31469976
Hielo,

Thank you for your help on this, i put a fix in place and havent seen this error in a week now but I am recoding my selects to account for this.  If it pops back up I will have to re-post again.

Thanks.

brad
brad_harum@picis.com
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question