Solved

ODBC Error

Posted on 2008-06-23
9
815 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help Required 2 46
Dinamic report to Crosstab query 9 49
Database maintenance 36 100
How come this XML node is not read? 3 27
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…
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.
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…
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…

761 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