Solved

ODBC Error

Posted on 2008-06-23
9
806 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now