Solved

ODBC Error

Posted on 2008-06-23
9
808 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
  • 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

776 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